下面的代码给了我意想不到的缩进我尝试了很多变化,但我不断收到这些错误或语法错误
while True:
try:
a=int(input("Please enter a number to be counted down to: "))
b=(a-1)
for count in range (100,b,-1):
print (count)
break
except:
print ("wohoo")
答案 0 :(得分:1)
while循环需要一个包含的代码块:
while True:
try:
a = int(input("Please enter a number to be counted down to: "))
b = (a-1)
for count in range(100, b, -1):
print(count)
except:
print ("wohoo")