Python程序中的语法错误

时间:2015-07-14 04:46:04

标签: python syntax

我是python的新手,我正在做改进的挑战。在这个挑战中,我正在制定一个程序来询问某人的年龄,看看他们是否已经足够投票了。我有一个语法错误,其中突出显示:在if行上,我不确定我做错了什么。

name = input("Hello User, welcome to the new voting system, to register please enter your name.")
age = int(input("Thank you " + name + ", please enter your name to continue.")

if age > 18:
   print("Congratulations " + name + " you are old enough to vote")
else:
   print("Sorry " + name + " you are not old enough to vote")

1 个答案:

答案 0 :(得分:1)

age = int(input("Thank you " + name + ", please enter your name to continue."))

需要另一个支架