python中是否有until
语句或循环?这不起作用:
x = 10
list = []
until x = 0:
list.append(raw_input('Enter a word: '))
x-=1
最佳答案
等效的是 while x != x
循环。
因此,您的代码变为:
x = 10
lst = [] #Note: do not use list as a variable name, it shadows the built-in
while x != 0:
lst.append(raw_input('Enter a word: '))
x-=1
关于python - 直到语句/循环python?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28423816/