Light Mode
Dark Mode
Common words
def checkio(first, second):
    a = set(first.split(","))
    b = set(second.split(","))
    return ",".join(sorted(a.intersection(b))


#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
    assert checkio("hello,world", "hello,earth") == "hello", "Hello"
    assert checkio("one,two,three", "four,five,six") == "", "Too different"
    assert checkio("one,two,three", "four,five,one,two,six,three") == "one,three,two", "1 2 3"

I get an error after checking, in PyCharm i get a syntax error like

if __name__ == '__main__':                             ^
SyntaxError: invalid syntax"

Can you help, please?

p.s. should i delete post after getting answer?

Created: April 29, 2019, 12:39 p.m.
Updated: May 30, 2019, 1:58 p.m.
1
7
User avatar
knsgvh