Write Python program to illustrate enumerate function


Topic: Write Python program to illustrate enumerate function

Solution

l1 = ["eat","sleep","repeat"] 
s1 = "geek"
obj1 = enumerate(l1) 
obj2 = enumerate(s1) 
print ("Return type:",type(obj1) )
print( list(enumerate(l1)) )
print( list(enumerate(s1,2)) )



List all Python Programs