The Pi picks a number between 0 and 100
The user tries to guess it
Team up by 2, and discuss how you would implement that
don't use Python yet, just use English
be PRECISE
First, the computer has to guess a number
to_guess = random.randint(1,100)
You will need import random at the top of your code
Second, we need to repeatedly ask the player for a guess
How can we handle the "repeatedly" part?
Do we know how many repeats will be needed?
You will need a while loop
found = False
while not found:
don't forget to set found to True somewhere
Asking for user input:
one line:
user_guess = raw_input("Please enter your guess:")
next line:
user_guess = int(user_guess)
Comparison
this is where you will set found = True somewhere
if user_guess > to_guess:elif user_guess < to_guess:else:
To see if two variables are equal, use ==
One = is an assignement, what's on the left takes the value of what's on the right
Two == is a comparison and will return True or False
To see if two variables are NOT equal, use !=
To give feedback to the user, use the print function
The whole program takes less than 15 lines
GOOD LUCK
For more fun, you can implement a counter and limit the user to 5 guesses, or 10 guesses