尝试混合while和raw_input命令

时间:2015-10-09 19:38:22

标签: python-2.7 if-statement while-loop raw-input

我对python IDLE非常陌生,我的任务是制作一款游戏,要求你猜一个随机数,这就是我所拥有的,但无论我输入什么,它都会返回"你也是高"非常感谢你的帮助。

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"

0 个答案:

没有答案