我从昨天开始学习python,在学习了一些基础知识之后,我尝试编写代码。如果我不了解基本知识,我就不能继续下去了。看看我的代码,请向我解释一下我的错误。
x=input()
if(x==10):
print("the number is 10")
elif(x>=10):
print("the number is more than 10")
else:
print("the number is less than 10") File "..\Playground\", line 4
elif(x>=):
^
SyntaxError: invalid syntax发布于 2019-06-03 16:14:41
input返回一个字符串,但是您想要一个int,您的string也是完全错误的:
x=int(input())
if(x == 10):
print("the number is 10")
elif(x >= 10):
print("the number is more than 10")
else:
print("the number is less than 10")https://stackoverflow.com/questions/56430699
复制相似问题