Hi if I have two list
x = ['a', 'b', 'c']
y = [1, 2, 3]
and I want to combine them and get similar combination of zip (list(zip(x,y))
) using list comprehension?
So the desired output I want is
[('a', 1), ('b', 2), ('c', 3)]
I tried
[(alp, num) for alp in x for num in y]
But in run two list in a nested way and I got output
[('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1), ('c', 2), ('c', 3)]
Is it possible to do so?