Unexpected EOF while parsing in python

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 19:36:11

问题


I am in an intro to programming class and we're making a calculator to figure out how many times a human heart has beaten given the number of years someone has been alive, and I keep getting unexpected EOF while parsing on the last line of code, can someone help me figure out why?

input("What is your name? ")
age= float(input("How old are you? "))
print("The average human heart beats 70 times a minute.")
beats_per_hour = 70 * 60
beats_per_day = beats_per_hour * 24
beats_per_year = beats_per_day * 365
beats_age = beats_per_year * age

print(format("Beats per minute: 70"))
print(format("Beats per hour:",beats_per_hour))
print(format("Beats per day:",beats_per_day))
print(format("Beats per year:",beats_per_year))
print(format("Your heart has taken",beats_age,"beats, since you were born.")enter code here

回答1:


I believe that your immediate problem is that you forgot the closing parenthesis on the last line: note how you have only one R_PAREN at the end of that one, but two on all the others. Also, do you want to save the user's name in line 1?

Here's a link to help with keyboard input.



来源:https://stackoverflow.com/questions/32387372/unexpected-eof-while-parsing-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!