Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

access key and value when looping over lists in Python

# Python3 code to iterate over a list
list = [1, 3, 5, 7, 9]
   
# Using enumerate() 
for i, val in enumerate(list):
    print (i, ",",val)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #access #key #looping #lists #Python
ADD COMMENT
Topic
Name
3+3 =