On Sun, May 04, 2014 at 04:17:57PM -0700, Stephen Mik wrote: > Any thoughts out there about > how to implement the Loops and Data Structures into a "Hangman Game" > programming problem?
Yes. Consider the basic structure of a single game: Guess a letter. Is it correct? Do something. Otherwise it is wrong, do another thing. And repeat until done. So there's your basic loop structure. You would write it something like this: while True: # Loop forever. We'll break out of the loop when done. guess a letter if letter in secret_word: # handle a correct guess # if all the letters are shown, break out of the loop else: # handle a wrong guess # if the guy has been hanged, break out of the loop if won: print("Yay, you won!") else: print("You got hanged!") Use the "break" command to escape the infinite loop, e.g. something like this: while True: # more code goes here... if won: break That should give you somewhere to start. -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor