Computer Science 11 - Unit 5


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? 

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值