Doing tutorial - my script shows different results.

vbMark vbmark at my-deja.com
Thu Sep 21 11:43:39 EDT 2000


In article <39C9FC13.F4C4853A at schlund.de>,
  Carsten Gaebler <cgaebler at gmx.de> wrote:
> 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?
>

Yes, that was it.  Thank you.


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



More information about the Python-list mailing list