Given the following lists:
a = ['a','b']
b = [1,2,3,4]
I'd like to produce this:
c = ['a1','a2','a3','a4','b1','b2','b3','b4']
So I basically want to join every element of b to each element in a.
I'd like an approach similar to this:
[x+str(y) for x in a and y in b]
Thanks in advance!
a = ['a','b']
b = [1,2,3,4]
c = [x+str(y) for x in a for y in b]
print(c)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With