初学者:不了解我的代码的错误在哪里

时间:2019-06-03 15:50:22

标签: python-3.x

从昨天开始我开始学习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

1 个答案:

答案 0 :(得分:1)

input返回一个字符串,但是您想要一个int,而且您的标识也很错误:

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")
相关问题