Range, Enumerate and Zip Functions
Range, Enumerate and Zip Functions
List function:
Range function:
By default when using a number you can use just the range
The first position is reserved for the number from which you start from
The second position is the range up to BUT not included number that you want to go to
The third position is the increment by which the numbers should increase, by default this is 1
ZIP function:
Is used to zip two items together:
Combines each element in pairs of tuples like this:
This is also known as
enumeration
Enumerate function:
There is also a dedicated enumerate function in python:
By default this starts with the Index position 0
If you want this to start with 1 do:
PreviousLooping and Unpacking with Dictionaries and TuplesNextMore Handy Functions and the Random Package
Last updated