Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for The End of Other by Degusto
def checkio(words_set):
words_set = list(words_set)
for i in range(len(words_set)):
j = i + 1
while j < len(words_set):
if words_set[i] != words_set[j] and (words_set[i].endswith(words_set[j]) or words_set[j].endswith(words_set[i])):
return True
j += 1
return False
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
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"
Nov. 18, 2015