I'm going through the Python Tutorial on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?
Code:
>>> 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']
I'm going through the Python Tutorial on the python website and needed a little extra explanation of what this code is actually doing. Maybe I'm just missing something obvious?
Code:
>>> 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']