关于缩进
为何不能。。。
例:
num=input("Enter a number:")
if num>0:
print "the number is positive"
elif num<0:
print "the number is negative"
print 300
而非要写成:
num=input("Enter a number:")
if num>0:
print "the number is positive"
elif num<0:
print "the number is negative"
print 300
意思就是说print 300为何不能跟上一个print对齐呢,还要缩进一次为何?
上一个例子的写法错在什么地方?
[解决办法]
num=input("Enter a number:")if num>0: print "the number is positive"elif num<0: print "the number is negative" print 300
[解决办法]
你的编辑器还是python解释器有问题吧,正常情况你贴出的那两个都会报缩进错误...