• Bug when checking code

Question related to mission The end of other


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/


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
            for w2 in words:
                if w1 == w2:
                elif w1.endswith(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"