multiplying a list by a nested list

I would have a inner zip, because a outer zip will zip with a and b, with each pairs of list with each element in a, so it will fail.

print([[y*z for y,z in zip(a,x)] for x in b])

Output:

[[2, 8, 18], [3, 10, 21]]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top