View Single Post
Old Jul 10th, 2007, 1:23 PM   #11
Dietrich
Professional Programmer
 
Dietrich's Avatar
 
Join Date: Feb 2005
Posts: 434
Rep Power: 4 Dietrich is on a distinguished road
Talking

I looked at the link, that note is simply a mistake in that case. It is correct if you line up a bunch of variables with commas directly after a print.

Another solution for the OP:
def square(x):
    return x * x

print "Value   Square"

for i in range(1, 6):
    print str(i) + "   " + str(square(i))
Now you have all strings and concatination works fine.

This would add a space for each comma used:
def square(x):
    return x * x

print "Value   Square"

for i in range(1, 6):
    print i, "   ", square(i)
__________________
I looked it up on the Intergnats!

Last edited by Dietrich; Jul 10th, 2007 at 1:38 PM.
Dietrich is offline   Reply With Quote