3 ms·
Thanks for this write up. I didn't know about enumerate. I never thought of swapping variables as in example 4 either. I noticed one small mistake in section 9
by kerpal 13y ago
Thanks for this write up. I didn't know about enumerate. I never thought of swapping variables as in example 4 either.
I noticed one small mistake in section 9:
d[keys] = values[i]
Should be:
d[key] = values[i]
- aaren 13y agoFor a good few months I was doing for i in range(len(input_list)): v = input_list[i] ...do something with v and i... enumerate is much nicer! for i, v in enumerate(input_list): ...