马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
作业要求:
You are to plan and then code a number guessing game, as described by the information and sampleoutput below. Use what you have learned in class, including selection, repetition and basic function.
At the start of the program an appropriate welcome message with your name in it should be shown,
then the user will be asked to enter their name. They then choose from a menu (see sample output for
menu choices). When the game is played, the computer randomly generates a number between lower
and upper bounds (inclusive). These default to 1 and 42. The user must then guess a number. This guess
should be error-checked until the user enters a valid guess. Error checking for all inputs should include
handling non-number and blank entries only. The user’s guess is then compared to the computer’s
number, and the computer responds as below with higher or lower. When the guess is correct, the user
is congratulated, told how many turns they took and offered the choice of saving their score to a file.
When the user chooses to view the instructions from the menu, the instruction is presented. For each
play of the game, the computer randomly generates a number between the lower and upper bounds
(inclusive) and the user must guess a number. This guess should be error-checked until the user gets it
right. Error checking for all inputs should include handling non-number and blanks. The guess is then
compared to the computer’s number, and the computer responds as below with higher or lower. When
the guess is correct, the user is congratulated, told how many turns they took.
Sample output from the program is below. You should make your program match this exactly (except
for your name). Do not add or remove anything from the program even if you think it would make it
better. You must aim to have yours work and look just like this including spaces, spelling – everything.
我的第一份Python编程作业希望大家帮忙看看哪里有不对的,谢谢。
|