[Tutor] loop example from 'Learning to Program'
ron
rondosxx at yahoo.com
Mon Jul 16 00:36:40 CEST 2007
ok, this code is written with vi:
#/usr/bin/env python
#foreach.py
myList = [1,2,3,4]
for index in range(len(myList)):
myList[index] += 1
print myList
~
here's the result:
~$ ./foreach.py
./foreach.py: line 3: myList: command not found
./foreach.py: line 4: syntax error near unexpected
token `('
./foreach.py: line 4: `for index in
range(len(myList)):'
I think I liked the first result better!
thanks again, ron
____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/
More information about the Tutor
mailing list