Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
intersection solution in Clear category for Common Words by Orthomonalus
def checkio(line1: str, line2: str) -> str:
# your code here
set1 = set(line1.split(','))
set2 = set(line2.split(','))
intersection = set1.intersection(set2)
return ','.join(sorted(intersection))
print("Example:")
print(checkio("hello,world", "hello,earth"))
# These "asserts" are used for self-checking
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("The mission is done! Click 'Check Solution' to earn rewards!")
Nov. 14, 2024
Comments: