Python Forum
MIt 6.0001 open courseware pset 2
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MIt 6.0001 open courseware pset 2
#2
[:] just makes a copy of whatever it slices, it otherwise doesn't change how that thing is iterated over.

For your problem note that you only want to return True if none of the characters return False. So you put the return True after and outside the loop:

for char in secret_word[:]: 
    if char not in letters_guessed:
        return False
return True
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
MIt 6.0001 open courseware pset 2 - by itme2003 - Oct-09-2018, 12:53 PM
RE: MIt 6.0001 open courseware pset 2 - by ichabod801 - Oct-09-2018, 06:53 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020