mercredi 4 septembre 2019

If statement and zip

I have three lists, say:

a = [1, 2, 3, 4, 5]
b = [a, b, c, d, e]

x = [1, 3, 5]

I want to do, with an output like:

for item in x:
    if item in a:
        print(zip(a[x], b))

1a
3c
5e

I am confused with how to print the corresponding item in a and the item from b. Any help would be much appreciated, thanks.

Aucun commentaire:

Enregistrer un commentaire