My Code:
def checkio(words_set):
for word1 in words_set:
for word2 in words_set:
if word1.endswith(word2):
return True
else:
return False
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio({u"hello", u"lo", u"he"}) == True, "helLO"
assert checkio({u"hello", u"la", u"hellow", u"cow"}) == False, "hellow la cow"
assert checkio({u"walk", u"duckwalk"}) == True, "duck to walk"
assert checkio({u"one"}) == False, "Only One"
assert checkio({u"helicopter", u"li", u"he"}) == False, "Only end"
# if word1 == word2:
# continue
Created at: 2014/09/09 12:25; Updated at: 2016/02/17 20:33