[Tutor] tutorial
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Wed, 23 Jan 2002 10:45:10 -0800 (PST)
On Wed, 23 Jan 2002, Remco Gerlich wrote:
> > >>> print "hello world"
> > hello world
> > >>> print "Here are the ten numbers from 0 to 9"
> > Here are the ten numbers from 0 to 9
> > >>> for 1 in range(10):
> > print 1,
> >
> > SyntaxError: can't assign to literal
> > >>>
> >
> > what am i doing wrong??
>
> Instead of 'for 1 in', it has to be 'for i in'. The character i (or
> another letter, but it was probably i in the tutorial), not the number
> 1.
>
> Similary, the print command should read "print i,"
I'll see if I have the time to change the tutorial at:
http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro
to use the variable name 'number' instead of the visually confusing 'i'.