为什么python while循环中的多个条件不起作用?

时间:2019-12-04 14:15:38

标签: python while-loop multiple-conditions

我似乎在代码中找不到问题...

user_decision = ""
while not user_decision == "yes" or not user_decision == "no":
    user_decision = input("You want to Join?: Please answer (yes/no): ")
else:
    if user_decision == "yes":
        print("test")
    else:
        print("test")

谢谢。...

1 个答案:

答案 0 :(得分:0)

我清理了一下:

user_decision = ""
while  (user_decision != "yes") and (user_decision != "no"):
    user_decision = input("You want to Join?: Please answer (yes/no): ")
    if user_decision == "yes":
        print("test yes")
    else:
        print("test not yes")