让我先说我对编程完全不熟悉。我最近刚学了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