小编use*_*600的帖子

Python - if语句无法正常工作

我刚刚开始使用python并且已经陷入了一些在我看来显然应该工作的东西.这是我的第一个代码,我只是尝试与用户进行对话.

year = input("What year are you in school? ")
yearlikedislike = input("Do you like it at school? ")
if (yearlikedislike == "yes" or "Yes" or "YES" or "yep" or "yup" or "Yep" or "Yup"):
    print("What's so good about year " + year, "? ")
    input("")     
    print("That's good!")
    time.sleep(1)
    endinput = input("I have to go now. See you later! ")
    exit()
if (yearlikedislike == "no" or "No" or "nope" or "Nope" or "NOPE"):
    print("What's so bad about year " + …
Run Code Online (Sandbox Code Playgroud)

python if-statement

2
推荐指数
1
解决办法
2538
查看次数

标签 统计

if-statement ×1

python ×1