Basically:
list1 = ['x', 'y', 'z']
list2 = [1, 2, 3]
And I want my output to be in the form of
x
y
y
z
z
z
I have
for i in range(0,len(list1)):
output = list1[i] * list2[i]
print(output)
But that only gets me
x
yy
zzz
Take the advantage of print()
function:
>>> from operator import mul
>>> for x in map(mul, list1, list2):
print(*x, sep='\n')
...
x
y
y
z
z
z
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