Doing tutorial - my script shows different results.

vbMark vbmark at my-deja.com
Thu Sep 21 13:47:22 CEST 2000


Greetings,

The script in the tutorial (7.1 Fancier Output Formatting) is:

>>> def go():
	import string
	for x in range(1,11):
		print string.rjust('x',2),string.rjust('x*x',3),
		print string.rjust('x*x*x',4)

The tutorial says the output should be:

 1   1    1
 2   4    8
 3   9   27
 4  16   64
 5  25  125
 6  36  216
 7  49  343
 8  64  512
 9  81  729
10 100 1000

But my output is:

 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x
 x x*x x*x*x

What is wrong?

Thanks,
Mark


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list