I would like to give some feedback about ...
I checked and double checked the code in IDLE and confirmed it returned the proper results. Please advise why this will not work when running through the website checker.**
==================_
From: http://www.checkio.org/mission/end-of-other/solve/
HTTP_USER_AGENT:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2
My Code:
def checkio(words):
for w1 in words:
if len(words) == 1:
return False
else:
for w2 in words:
if w1 == w2:
continue
elif w1.endswith(w2):
return True
else:
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"
Created at: 2014/09/14 22:32; Updated at: 2015/11/08 08:02