I\'m new to Python, so I\'ve been running through my own set of exercises to simply start memorizing basic functions and syntax. I\'m using Pycharm IDE and Python 3.4. I\'ve
Please remember (or if you don't know it yet, read up on the subject) that print is a function in Python 3. In Python 2, your first line would concatenate "Type string: " and "123" and then print them. In Python 3, you are calling the print
function with one argument, which returns None
, and then add "123" to it. That doesn't make any sense.
The second line doesn't generate an error in Python 2 or 3 (I've tested it with 2.7.7 and 3.2.3). In Python 2, you get
Concatenate strings and ints 10
while in Python 3, your script should only print
Concatenate strings and ints
This is because again, print is a function, therefore you call it with the argument "Concatenate strings and ints". The , 10
makes your line a tuple of the return value of print
, which is None
, and 10
. Since you don't use that tuple for anything, there is no visible effect.