Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

enumerate zip together

# create a list of names
names = ['Messi', 'Mane']
  
# create a list of subjects
subjects = ['hat-trick', ' hat-trick']
  
# create a list of marks
marks = [99, 98]
  
# use enumerate() and zip() function
# to iterate the lists with t function
for i, t in enumerate(zip(names, subjects, marks)):
    print(i, t)
 #Ouput:
0 ('Messi', 'hat-trick', 99)
1 ('Mane', 'hat-trick', 98)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #enumerate #zip
ADD COMMENT
Topic
Name
1+6 =