I want to multiply a vector by a scalar by a cicle, i.e:
x1=[2,3,4,5]
and i want to multiply it by 2, so that i get, x1=2(x2)
, x2=[4,6,8,10]
.
I tried doing this:
def multiplicar_vector(x1):
x2=[]
for i in x1:
x2[i] = (x1[i])*2
print(x2)
But it doesn't work.