Question on for loop

newtopython roshen.sethna at
Mon Mar 4 13:18:20 CET 2013

Hi all,

I'm super new to python, just fyi.

In the piece of code below, secretWord is a string and lettersGuessed is a list. I'm trying to find out if ALL the characters of secretWord are included in lettersGuessed, even if there are additional values in the lettersGuessed list that aren't in secretWord. 

What this code is doing is only checking the first character of secretWord and then returning True or False. How do I get it to iterate through ALL of the characters of secretWord?

for character in secretWord:
        if character not in lettersGuessed:
        return True
return False



More information about the Python-list mailing list