Python TypeError: meaning and fix

TypeError: This kind of value cannot do that.

Code that causes it

age = 15
print("나이: " + age)
Open in the runner

You joined text and a number with +. You passed the wrong number of values to a function. You did math on something that is not a number.

Check the kind of a value with type(). Use str() or an f-string to put a number into text.

How to fix it

age = 15
print("나이: " + str(age))
Open in the runner

Why it happens

Every value in Python has a type. Text and numbers are different types, so they cannot be added as they are.

The official docs are in English. See it in the official Python docs

Back to the runnerMore errors