# consider the following list with 4 elements 
L = [1,-2,0,5]
print(L)

# 3 * v
v = [1,-2,0,5]
print("v is",v)
# we use the same list for the result
for i in range(len(v)):
    v[i] = 3 * v[i]
print("3v is",v)

# -0.6 * u
# reinitialize the list v
v = [1,-2,0,5]
for i in range(len(v)):
    v[i] = -0.6 * v[i]
print("0.6v is",v)

u = [-3,-2,0,-1,4]
v = [-1,-1,2,-3,5]
result=[]
for i in range(len(u)):
    result.append(u[i]+v[i])

print("u+v is",result)

# let's also print the result vector similar to a column vector
print() # print an empty line
print("the elements of u+v are")
for j in range(len(result)):
    print(result[j])

from random import randrange
#
# your solution is here
#

#r=randrange(-10,11) # randomly pick a number from the list {-10,-9,...,-1,0,1,...,9,10}


#
# your solution is here
#


v = [-1,-3,5,3,1,2]

length_square=0
for i in range(len(v)):
    print(v[i],":square ->",v[i]**2) # let's print each entry and its square value
    length_square = length_square + v[i]**2 # let's sum up the square of each entry

length = length_square ** 0.5 # let's take the square root of the summation of the squares of all entries
print("the summation is",length_square)
print("then the length is",length)

# for square root, we can also use built-in function math.sqrt
print() # print an empty line
from math import sqrt
print("the sqaure root of",length_square,"is",sqrt(length_square))

#
# your solution is here
#


#
# your solution is here
#
