Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
The End of Other solution in Uncategorized category for The End of Other by vvm70
def checkio(words_set):
s = sorted(words_set, key=len)[::-1]
return any(word.endswith(suff) for i, word in enumerate(s[:-1]) for suff in s[i+1:])
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
print("Example:")
print(checkio({"hello", "lo", "he"}))
assert checkio({"hello", "lo", "he"}) == True, "helLO"
assert checkio({"hello", "la", "hellow", "cow"}) == False, "hellow la cow"
assert checkio({"walk", "duckwalk"}) == True, "duck to walk"
assert checkio({"one"}) == False, "Only One"
assert checkio({"helicopter", "li", "he"}) == False, "Only end"
print("Done! Time to check!")
June 29, 2020