Python Example | An Introduction to Python enumerate()

This python example code shows you how to use enumerate() function correctly.

days= { 'Mon', 'Tue', 'Wed','Thu'}
enum_days = enumerate(days)
# enumearte using loop
for enum_days in enumerate(days):
   print(enum_days)

for count,enum_days in enumerate(days,5):
   print(count,enum_days)

The code will output:

(0, 'Thu')
(1, 'Tue')
(2, 'Wed')
(3, 'Mon')
5 Thu
6 Tue
7 Wed
8 Mon