Python 程序中的语法错误
Syntax error in a Python program
我是 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")
age = int(input("Thank you " + name + ", please enter your name to continue."))
需要另一个支架
我是 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")
age = int(input("Thank you " + name + ", please enter your name to continue."))
需要另一个支架