Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

using enumerate() and zip() together

names = ['Alice', 'Bob', 'Charlie']
ages = [24, 50, 18]

for i, (name, age) in enumerate(zip(names, ages)):
    print(i, name, age)
# 0 Alice 24
# 1 Bob 50
# 2 Charlie 18
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+6 =