Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for The End of Other by Vasily__Chibilyaev
def checkio(words):
for w1 in words:
for w2 in words:
if w1==w2 or len(w1)<=len(w2): continue
if w1[len(w1)-len(w2):]==w2: return True
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"
Sept. 20, 2017
Comments: