vendredi 9 octobre 2015

Trying to mix while and raw_input commands

I'm very new to python IDLE, I have been tasked with making a game that asks you to guess a random number, here is what I have but whatever I type in it returns "you were too high" a little help would be very appreciated thanks.

import random
i = random.randint(0,100)
print (i)

e = raw_input ("Guess what number I'm thinking of between 0 and 100!")
while e != i:
     if i > e:
        print "You were too low."
     elif i < e:
        print "You were too high."
     e = raw_input ("Guess what number I'm thinking of between 0 and 100!")
if e == i:
    print "yay"

Aucun commentaire:

Enregistrer un commentaire