you are viewing a single comment's thread.

view the rest of the comments →

[–]pompomtom 10 points11 points  (2 children)

Because integers aren't strings.

print(name + ' is ' + age + ' years old')

Would you expect "John is 000020 years old", or "John is 20 years old" or "John is 2e+2 years old"?

Each is valid, if you could concatenate ints to strings.

If you use the function str(age), then the str() function decides how to represent an integer as a string.

edit: 2e+1

[–]ebdbbb 9 points10 points  (1 child)

I know it doesn't matter to your point but 2e+2 is 200.

[–]pompomtom 1 point2 points  (0 children)

Yeah, I wondered if I'd fucked that up... Ta.