[Tutor] Help with Python Program
Carolina Dianne LaCourse
carolina.cadi at maine.edu
Sat Feb 25 04:18:27 CET 2012
I have never programed before and am brand new to python also. I am
trying to create a Hi-Lo game and am not really sure where to start.
These are the instructions that I have. I know that I will need to
import the random number generator and have looked up how to do that.
I understand that I need to ask for raw input from the user and that I
need to be able to use the if elif else to tell the user whether their
number matches or id too high or to low but am just not sure what to
do first. Any advice would be greatly appreciated! I have tried some
online tutorials to get the basics but still am having a really hard
time. I did work with scratch a bit earlier this semester and got
that, but am really struggling with python.
For your second project, you will create a Python guessing game. In
this game, the user will be asked to guess a number between 1 and 100.
For each guess, you will output one of three things:
The user guess is correct -- tell the user he or she won,
asking if he/she wants to play again.
The user guess is too high -- tell him or her so.
The user guess is too low -- tell him or her so.
Your program should be able to run multiple games. That is, after
each game, the user should be asked if they want to play again. If
they type yes, then you pick a new number and play again. If they type
no, then the program should say goodbye and exit. You should keep the
following stats about the player's efforts:
Number of games played
Total number of guesses made
You should output the number of games played as well as the
average number of guess per game. This program will require loops
(nested ones, in fact), an if-elif-else statement, and the use of
Python's random number generator.
More information about the Tutor