当我尝试运行此程序时,我总是收到“无效的语法”消息。它在“else”声明之后突出显示红色的“年龄”。我不确定我做错了什么。PYTHON语法错误无效?
age = float(input('How old are you? '))
citizen = float(input('How long have you been an American citizen? '))
if age >= 30 and citizen >= 9:
print('You are eligible to become a US Senator and a House Representative!')
else age <30>= 25 and citizen <9>= 7:
print('You are only eligible to become a House Representative.')
if age < 25 or citizen < 7:
print('You are not eligible to become a US Senator or a House Represenatative.')
什么是语法错误的完整回溯?它应该有一个行号,行预览,字符位置等。[编辑]你的问题,包括该信息 – mhlester
'else ...'无效。你的意思是'elif ...' – SethMMorton
'age < 30 > = 25'也很奇怪(在这种情况下它不会做你想做的事情) – njzk2