Doing tutorial - my script shows different results.
Carsten Gaebler
cg at schlund.de
Thu Sep 21 08:16:19 EDT 2000
You use the wrong quotes. Use backticks instead: `x`, `x*x`, etc.
vbMark wrote:
>
> 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?
More information about the Python-list
mailing list