program ignoring if statement, and printing True when False

后端 未结 4 783
心在旅途
心在旅途 2021-01-27 03:15

I am writing a simple program for a homework problem and It seems to be skipping my if statement. I have looked at other questions posed, and the problems there do not seem to b

4条回答
  •  一生所求
    2021-01-27 03:58

    Wouldnt it be the same just doing:

    ``

    def isWordGuessed(secretWord, lettersGuessed):
    
    if not lettersGuessed:
        return False
    for i in lettersGuessed:
        if i not in secretWord:
            return False
    return True
    

    What your doing is called chained comparisons.

    Edit: My bad, too late

    BR Daniel

提交回复
热议问题