if a>10:
print("your number is greater than 10") #indent the print statement
else:
print('Not greater than 10')
#you need to perform an action inside the else condition
a=input()
if a>10:
print("your number is greater than 10")
else:
# You didn't have anything in your else statement so either remove it or add a statement...
print("your number is <= 10")
出现缩进错误:
其中}。在
elif
和else
部分是可选的,elif
表示{PS:使用
int(input())
否则将得到一个字符串而不是一个int你的缩进不正确。应该如下所示:
参见python documentation on indentation。在
相关问题 更多 >
编程相关推荐