0

I have two lists and I want them to time each other one by one and create a new list like the following:

vx=[40.00000000000001, 32.00000000000001, 27.528951416567008, 24.787883378136915, 23.02339491459251, 21.846818145611152, 21.027776019653995, 20.413445666052425, 19.89116281938412, 19.368416481078107, 18.760291921319446]
t= [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]

new list : [ vx[0]*t[0],vx[1]*t[1],vx[2]*t[2],...]

How should I achieve it?

gggjackie
  • 63
  • 7

2 Answers2

5

Try this:

new_list = [a*b for a, b in zip(vx, t)]
bananafish
  • 2,877
  • 20
  • 29
1

You could zip the two lists:

result = [z[0] * z[1] for z in zip(vx, t)]
Mureinik
  • 297,002
  • 52
  • 306
  • 350