Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Common Words by mouseofsack911
def checkio(line1: str, line2: str) -> str:
line1 = line1.split(",")
line2 = line2.split(",")
common = []
for elem in line1:
if elem in line2:
common.append(elem)
common.sort()
return ','.join(common)
if __name__ == '__main__':
print("Example:")
print(checkio('hello,world', 'hello,earth'))
# These "asserts" are used for self-checking and not for an auto-testing
assert checkio('hello,world', 'hello,earth') == 'hello'
assert checkio('one,two,three', 'four,five,six') == ''
assert checkio('one,two,three',
'four,five,one,two,six,three') == 'one,three,two'
print("Coding complete? Click 'Check' to earn cool rewards!")
April 27, 2021