character_name = "Mark"
character_age = 50
print("There was a man called " + character_name + ", ")
print("he was " + character_age + " years old. ")
character_name = "Pete"
print("He really liked the name " + character_name + ", ")
print("but didn't like being " + character_age + ". ")
error message
Error:
C:\Users\steve\PycharmProjects\variables\venv\Scripts\python.exe C:/Users/steve/PycharmProjects/variables/variables.py
There was a man called Mark,
Traceback (most recent call last):
File "C:/Users/steve/PycharmProjects/variables/variables.py", line 9, in <module>
print("he was " + character_age + " years old. ")
TypeError: can only concatenate str (not "int") to str