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/11/24 04:40:45
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()