[Tutor] Help with Python Program

bob gailer bgailer at gmail.com
Sat Feb 25 04:41:43 CET 2012


On 2/24/2012 10:18 PM, Carolina Dianne LaCourse wrote:
> Hi,
> 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
What is scratch?
> a bit earlier this semester and got
> that, but am really struggling with python.
We get many requests like this. I always wonder why there is a mismatch 
between the course and the student. A beginner's programming class 
should give you the tools you need to solve the problem. Can you help us 
understand why this is not happening for you?

I assume this is not your fault - that there is something wrong with the 
course and/or the instructor.

As a rule we don't write the program for you; we take a look at what 
you've done and help you over the rough spots. Please write any amount 
of code you can and return with that.
>
> For your second project,
What was the first project? How did that go?
>   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.
Do you know how to create a loop? If not, why not?
Do you know how to test for low or high? If not why not?
If your answers to these questions is no then (IMHO) you are in the 
wrong class.

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list