Skip to content
Sign upLog in
← Back to Community
How would you multiply lists?
Profile icon
pandadrum

How would you multiply lists? It is supposed to be an easy problem please help me!
L❤ve,
Anonymus

Voters
Profile icon
lisaharden
Profile icon
pandadrum
Comments
hotnewtop
Profile icon
RYANTADIPARTHI

Solution

if you want to multiple each element of the list into a new list, try this.

list1 = [1, 2, 3] list2 = [4, 5, 6] answer = [a * b for a, b in zip(list1, list2)] print(answer)

like that.
That should work

Profile icon
pandadrum

@RYANTADIPARTHI
Thank you so much!

Profile icon
SixBeeps

Are you looking to multiply all the numbers in a list together, or rather perform cross/dot products?