Wednesday, November 4, 2020


Example Program For enumerate() function in python

 enumerate() function in python adds counter to a iterable and returns it in the enumerate python program.

Syntax : -

enumerate(iterable, start=0)
  • Two parameters are used the first one is an object which is accept the iteration.
  • The second one is start parameters which is a starting point of counting but it's optional. If start is extinct the it's take 0 at start.
  •   enumerate() function return the object after adding the counter to an iterable.

Example Program for enumerate() in Python

grocery = ['bread', 'Tea', 'jam']
enumerateGrocery = enumerate(grocery)


# converting the gienvalue into a list

# changing the default counter
enumerateGrocery = enumerate(grocery, 10)


Program for enumerate in Python
Program for enumerate() in Python


Post a Comment