...

View Full Version : Tutorial Help



SoccerGee
01-11-2012, 07:00 AM
I'm going through the Python Tutorial (http://docs.python.org/tutorial/controlflow.html) on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?


>>> for x in a[:]: # make a slice copy of the entire list
... if len(x) > 6: a.insert(0, x)
...
>>> a
['defenestrate', 'cat', 'window', 'defenestrate']

SoccerGee
01-11-2012, 07:11 AM
I'm going through the Python Tutorial (http://docs.python.org/tutorial/controlflow.html) on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?


>>> for x in a[:]: # make a slice copy of the entire list
... if len(x) > 6: a.insert(0, x)
...
>>> a
['defenestrate', 'cat', 'window', 'defenestrate']

never mind... it's obviously past my bed time. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum