If I use:
>>> n = input("What is your name? ") What is your name? 23 >>> print("Hello " + n)
The Output is
Then it prints correctly. But if I use:
>>> n = 1 >>> print("Hello" + n)
Traceback (most recent call last): File "<pyshell#74>", line 1, in <module> print("Hello" + n) TypeError: can only concatenate str (not "int") to str
Then it gives an error.
I know that it is not allowed to print numbers with string without using the
str() function, so in the first case why does it not give an error?