为什么我在Python中收到错误代码?
问题描述:
我试图在变量中写一些数字数据,但是我收到了一个错误。
我尝试了什么:
boy_name =Steve
print(我是+ boy_name +,)
character_age = 11
print(我是+ character_age +,)
i was trying to write some numerical data in variables but i am getting a error.
What I have tried:
boy_name = "Steve"
print("I am " + boy_name + ",")
character_age = 11
print("I am " + character_age + ",")
答
因为它不会自动转换类型。
尝试:
Because it won't automatically convert types.
Try:
print("I am " + str(character_age) + ",")