Mega Code Archive

 
Categories / Python / Buildin Function
 

Looping through a sequence

# the position index and corresponding value can be retrieved at the same time using  # the enumerate() function.   for i, v in enumerate(['tic', 'tac', 'toe']):      print i, v