程序不会对字符串输入语句作出反应

时间:2014-10-13 10:34:20

标签: python if-statement while-loop

我希望程序对特定的字符串输入做出反应。在我的情况下,它是"no""n",但它不是;这里的错误在哪里?

import random
print ("hi this is a surprise generation app")
y1=""
y=""

y=input("wanna try?")
if y!="no" or "n": # doesn't react to NO input here
    y1=y
    while y1!="no" or "n": # doesn't react to NO input here
        x=random.randint (1,2)
        if x==1:
            print("you've got a free account @ counter-strike")
            y1=input("one more time?")

        elif x==2:
            print ("your suprise is a cake")
            y1=input("one more time?")

else:

    input ("\n")`

0 个答案:

没有答案