Vectorization

In any programming language, vectorization is a much more efficient way of dealing with numbers over writing a for loop. Following is an example in python

x = [1, 2, 3]
y = [4, 5, 6]

def sum_of_product(x, y):
    summation = 0
    for i in range(0, len(x)):
        summation += x[i] * y[i]
    return summation

The above for loop can be implemented much more efficiently as follows using numpy:

import numpy as np

x = [1, 2, 3]
y = [4, 5, 6]

def sum_of_product(x, y):     
	summation = np.dot(x,y) 
	return summation

This way, the code is efficient as well as concise.