我收到此错误:print("I am " + 187 + " years old") TypeError: can only concatenate str (not "int") to str

时间:2021-06-19 14:44:16

标签: python-3.9

当我尝试运行时:

User_Person = input("What is your name? ")

print("Hello " + User_Person + " i am 2xx-350")

User_Age = int(input("How old are you?"))

Robot_Age = 187

I_am_years_older = Robot_Age - User_Age

if User_Age == Robot_Age:
print("I am " + Robot_Age + " years old too")
else:
print("I am " + 187 + " years old")
print("That means i am " + I_am_years_older + " 
years older than you.")

我是初学者,所以我可能只是遗漏了一些明显的东西 请指出任何解决方案

0 个答案:

没有答案