让我开始说我完全是编程新手.我最近刚刚收拾了Python,它一直踢我的头脑,一个重复的错误 – “预计一个缩进的块”
现在,我知道还有其他几个线程解决了这个问题,我已经看了很多,但是,即使检查我的缩进还没有给我更好的结果.我已经用4个空格替换了所有的缩进,甚至重写了几次代码.我会发布这个计数器作业作为一个例子.
option == 1
while option != 0:
print "MENU"
option = input()
print "please make a selection"
print "1. count"
print "0. quit"
if option == 1:
while option != 0:
print "1. count up"
print "2. count down"
print "0. go back"
if option == 1:
print "please enter a number"
for x in range(1, x, 1):
print x
elif option == 2:
print "please enter a number"
for x in range(x, 1, 1):
elif option == 0:
break
else:
print "invalid command"
elif option == 0:
break