A type error if I do not concatenate an argument

Hey,

I’m doing the Programming with Python intensive and I’m learning functions. It asks that I concatenate the number to the string by using the str function. http://prntscr.com/m3gyg2

Why?

Thank you,

Cedobor

1 Like

I haven’t found a satisfying answer myself but i believe it has to do with creating the strings.

Python sees it as basic math.

string + string = longer string
number + number = sum of number
string + number =  ??? (so it throws a error instead.)

so we concatenate it to string so it sees it as string+string

3 Likes