grocery = [‘Bread’, ‘milk’, ‘butter’]
enumerateGrocery = enumerate(grocery)
print(type(enumerateGrocery))
print(list(enumerateGrocery))
enumerateGrocery = enumerate(grocery, 20)
print(list(enumerateGrocery)
output:
<class ‘enumerate’>
[(0, ‘Bread’), (1, ‘milk’), (2, ‘butter’)]
[(20, ‘Bread’), (21, ‘milk’), (22, ‘butter’)]
please tell how and why the output come this and what is enumerate function and use of it?