Answers for "python enumerate with zip"

10

enumerate zip python

alist = ['a1', 'a2', 'a3']
blist = ['b1', 'b2', 'b3']

for i, (a, b) in enumerate(zip(alist, blist)):
    print i, a, b
Posted by: Guest on March-18-2020
0

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
Posted by: Guest on November-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language