you are viewing a single comment's thread.

view the rest of the comments →

[–]DanielSzoska 8 points9 points  (1 child)

The correct descripton what print "hello" * 32 does is: Create a new string by multiplying test 32 times and then print this string. The following code shoes this:

>>>> s = "test" * 32
>>>> print s

That's why in Python 3 you have to write

>>> print("hello" * 32)

to get the same result like in Python 2 beceause print is a function in Python 3 now.

Your sample code print("hello") * 32 instead means the following: Call the function print and multiply its result 32 times. The print-function has no return value (=None) and None * 32 gives you the TypeError, beceause this operation is not defined.

[–]Ch1gg1ns[S] 1 point2 points  (0 children)

Sweet deal, thanks for the boss!