python 就是输入'done'的时候,能跳出while loop,不然就继续在while里面.def userChoice():global nn = "done"while n = "done":n = input("Please enter your choice:")userChoice()错在哪了?如果我改成while n=="done",然后输入done,
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/04 12:34:03
![python 就是输入'done'的时候,能跳出while loop,不然就继续在while里面.def userChoice():global nn =](/uploads/image/z/14078827-19-7.jpg?t=python+%E5%B0%B1%E6%98%AF%E8%BE%93%E5%85%A5%27done%27%E7%9A%84%E6%97%B6%E5%80%99%2C%E8%83%BD%E8%B7%B3%E5%87%BAwhile+loop%2C%E4%B8%8D%E7%84%B6%E5%B0%B1%E7%BB%A7%E7%BB%AD%E5%9C%A8while%E9%87%8C%E9%9D%A2.def+userChoice%28%29%3Aglobal+nn+%3D+%22done%22while+n+%3D+%22done%22%3An+%3D+input%28%22Please+enter+your+choice%3A%22%29userChoice%28%29%E9%94%99%E5%9C%A8%E5%93%AA%E4%BA%86%3F%E5%A6%82%E6%9E%9C%E6%88%91%E6%94%B9%E6%88%90while+n%3D%3D%22done%22%2C%E7%84%B6%E5%90%8E%E8%BE%93%E5%85%A5done%2C)
python 就是输入'done'的时候,能跳出while loop,不然就继续在while里面.def userChoice():global nn = "done"while n = "done":n = input("Please enter your choice:")userChoice()错在哪了?如果我改成while n=="done",然后输入done,
python
就是输入'done'的时候,能跳出while loop,不然就继续在while里面.
def userChoice():
global n
n = "done"
while n = "done":
n = input("Please enter your choice:")
userChoice()
错在哪了?如果我改成while n=="done",然后输入done,它就一直都在while里,但是我想要输入done的时候,它能跳出while,我以为改成 = 就可以了,可是还是不行.
python 就是输入'done'的时候,能跳出while loop,不然就继续在while里面.def userChoice():global nn = "done"while n = "done":n = input("Please enter your choice:")userChoice()错在哪了?如果我改成while n=="done",然后输入done,
'''
Created on 2011-2-20
@author:louis
'''
def userChoice():
global n
n = ""
while n != "done":
n = raw_input("Please enter your choice:")
print n
userChoice()