I'm fairly new to python and i'm trying to learn the while loop more, so I'm attempting to make this code to allow the user to try again and guess the number.
import random
number = random.randrange(1, 6)
print "Guess the number, between 1 and 6"
guess = int(raw_input('>'))
if guess == number:
print "Good job! You got it right!"
print number
elif guess > number:
print "Too High"
print number
elif guess < number:
print "Too Low"
print number
Aucun commentaire:
Enregistrer un commentaire