[Tutor] Re: hello. I need some help pls (fwd)

Matt Smith smith-matt at tiscali.co.uk
Fri Jul 16 19:23:59 CEST 2004


On Fri, 16 Jul 2004 10:03:56 -0700, Danny Yoo wrote:

>>>> 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

You need to use a valid variable name (eg. a letter or a string that
starts with a letter).  Try this:

>>> for number in range(10):
        print number

that should produce the desired result.

Matt.



More information about the Tutor mailing list