You may work with one partner on this assignment. If you work with
a partner, put your name and the name of your partner in the list of
authors in your program. Only one partner needs to run
handin21 to submit the files for the group. Both partners
will receive the same grade.
Let's play hangman! I will pick a secret word. On each turn, you guess a letter. If the letter is in the secret word, I will show you where it appears. You only get 6 incorrect guesses. Good luck. Secret word: - - - - - - - Letters guessed: You have 6 wrong guesses left Your guess: e Secret word: - - - - - - - Letters guessed: E You have 5 wrong guesses left Your guess: I Secret word: - - - - - I - Letters guessed: E I You have 5 wrong guesses left Your guess: n Secret word: - - - - - I N Letters guessed: E I N You have 5 wrong guesses left Your guess: o Secret word: - - - - - I N Letters guessed: E I N O You have 4 wrong guesses left Your guess: u Secret word: - U - - - I N Letters guessed: E I N O U You have 4 wrong guesses left Your guess: m Secret word: - U M - - I N Letters guessed: E I M N O U You have 4 wrong guesses left Your guess: s Secret word: - U M - - I N Letters guessed: E I M N O S U You have 3 wrong guesses left Your guess: P Secret word: P U M P - I N Letters guessed: E I M N O P S U You have 3 wrong guesses left Your guess: k Secret word: P U M P K I N Congratulations, you guessed the word! And you only had 3 wrong guessesIn the next sample run of the game the user is not able to guess the secret word. Notice that the program checks if the letter guessed has been guessed before, or if the user has entered an invalid letter. In either of these cases, the input is consider a wrong guess.
Let's play hangman! I will pick a secret word. On each turn, you guess a letter. If the letter is in the secret word, I will show you where it appears. You only get 6 incorrect guesses. Good luck. Secret word: - - - - - - Letters guessed: You have 6 wrong guesses left Your guess: sagjkf Please enter only a single letter Secret word: - - - - - - Letters guessed: You have 5 wrong guesses left Your guess: 8 Please enter only a single letter Secret word: - - - - - - Letters guessed: You have 4 wrong guesses left Your guess: R Secret word: - - R - - - Letters guessed: R You have 4 wrong guesses left Your guess: S Secret word: - - R - - - Letters guessed: R S You have 3 wrong guesses left Your guess: T Secret word: - - R - T - Letters guessed: R S T You have 3 wrong guesses left Your guess: E Secret word: - - R - T E Letters guessed: E R S T You have 3 wrong guesses left Your guess: L Secret word: - - R - T E Letters guessed: E L R S T You have 2 wrong guesses left Your guess: E You already guessed this letter Secret word: - - R - T E Letters guessed: E L R S T You have 1 wrong guesses left Your guess: O Sorry you lost! Secret word: P I R A T E
Once you are satisfied with your programs, hand them in by typing handin21 in a terminal window.