read from user

Mikael Olofsson mikael at isy.liu.se
Tue Nov 19 09:42:48 EST 2002


Hi again!

On Tue, 19 Nov 2002 15:36:42 +0100
Me, myself and I wrote:
> Did you not get an error traceback? When I tried that in the
> interactive shell, I got 
> 
> Traceback (most recent call last):
>   File "<stdin>", line 2, in ?
> NameError: name 'L' is not defined
> 
> after typing in the for loop. It simply tells you that there is no
> variable called L. What you need to do is to initiate L as an empty
> list before entering the loop.

I should have thought twice. You also need to append the new value to
your list in the loop, not assign it to L[i], since that slot does not
exist at the time.

/Mikael

-----------------------------------------------------------------------
E-Mail:  mikael at isy.liu.se
WWW:     http://www.dtr.isy.liu.se/dtr/staff/mikael               
Phone:   +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339

         /"\
         \ /     ASCII Ribbon Campaign
          X      Against HTML Mail
         / \

This message was sent by Sylpheed.
-----------------------------------------------------------------------
Linköpings kammarkör: www.kammarkoren.com




More information about the Python-list mailing list