我的代码:
birthYear = input("When were you born?")
thisYear = 2018
hippoSpan = 50
pabloSpan = 1881
print("You were born in " + str(birthYear) + " and currently it is 2018.")
print("")
print("You are " + str(thisYear - birthYear) + " years old.")
print("If you were a hippo, you would have " + str(hippoSpan - birthYear) + " years left to live.")
print("Pablo Picasso is " + str(pabloSpan - birthYear) + " years older than you.")
我不确定我在这里做错了什么,但是我试图让用户输入到变量中,因此用户将其输入为birthYear
,然后可以使用它减去来自thisYear
。请指出任何错误。