相关疑难解决方法(0)

344
推荐指数
6
解决办法
30万
查看次数

Python:while循环的非常基本的帮助

我到处寻找我的问题的答案,我仍然无法弄清楚!答案可能很简单,但我无法得到它,也许是因为我刚回到Python ...

无论如何,我想创建一个while循环,这样在用户输入"y"或"n"之前,问题将继续被问到.这就是我所拥有的:

while True:   # to loop the question
    answer = input("Do you like burgers? ").lower()
    if answer == "y" or "n":
        break 
Run Code Online (Sandbox Code Playgroud)

说实话,我真是太困惑了,所以我求求别人的帮助:)

python while-loop

3
推荐指数
1
解决办法
76
查看次数

标签 统计

python ×2

python-3.x ×1

while-loop ×1