program讲解 、辅导 Python设计编程
            
                Computer Science 11 - Unit 5 
 
Inquiry Question 
Can the pencil and paper game of Hangman be created and played in Python? 
Are there any differences between the paper version and the Python version? 
General Instructions 
Hangman is a paper and pencil guessing game. One player thinks of a word, phrase, or 
sentence and the other player attempts to guess it by suggesting letters. The player has a 
limited number of incorrect guesses. For each incorrect guess, a part of the stick figure on the 
noose is added. Once a full stick figure is drawn, the game is over, and the guessing player 
has lost. 
 
Using Python’s “random” module, as well as functions and loops, can you write a Python 
program in which a user guess words that the computer has chosen randomly? 
 
Page 1 of 5 
 Computer Science 11 - Unit 5 
Materials you’ll need: 
● Pencil 
● Computer 
 
Project submission: 
Submit the completed pages of this project as well as the .py code file for your Hangman program. 
 
Design Specifications 
 Use at least one list (to store guesses made). 
 Only accept valid guesses (letters only). Lowercase and uppercase letters should be 
accepted. 
 Use at least one loop, to prompt the user for each guess. 
 Keep track of incorrect guesses, the game is over and the player has lost once the user 
has made more than the allowed number of incorrect guesses. 
Do not allow a guessed letter to be guessed again. 
 After each guess, output the incomplete word (use underscores for hidden letters). 
 Choose a word or phrase randomly (can be from a list of hard coded options). Use 
Python’s “random” module. 
 Define and use at least 3 functions. 
Bonus Options 
 Find a better way to select random words other than hard coding them into the program. 
Could you download a dictionary of words and use that? Could you query a website for a 
random word? 
 [HARD] Create a graphical user interface (GUI) for your Hangman game using the 
Tkinter module. 
Page 2 of 5 
 Computer Science 11 - Unit 5 
Hints and Resources 
Here is a full example of how your program might look when you run it in the console. 
 
Page 3 of 5 
 Computer Science 11 - Unit 5 
 
Questions 
Given a list of random words stored in a variable “WORDS”, how will you choose a random word 
from the list? 
 
Using pseudocode, write a function to detect whether the user has correctly guessed the entire 
word. The function should accept a list of guesses, as well as the word the user is trying to 
guess. 
 
Page 4 of 5 
 Computer Science 11 - Unit 5 
 
What are the differences between your computer version of Hangman and the traditional pencil 
and paper version? Why are there these differences? 
 
Did you struggle with any particular part of this project? How did you finally resolve the issue? 
Page 5 of 5 
 
            
         
        
    
        
        
            
                - QQ:99515681 
- 邮箱:99515681@qq.com 
- 工作时间:8:00-21:00 
- 微信:codinghelp
 
     
    
    
    
 
        
        
        
    
        
            联系我们 - QQ: 99515681 微信:codinghelp
        
 
        
        
            程序辅导网!