enumerate python

Posted by w3diy - 5 months ago

Example 1: How enumerate() works in Python?

website = ['pakainfo', 'w3diy', '4cgandhi']
enumerateWebsite = enumerate(website)

print(type(enumerateWebsite))

# converting to list
print(list(enumerateWebsite))

# changing the default counter
enumerateWebsite = enumerate(website, 10)
print(list(enumerateWebsite))