Write a function to calculate the residual sum of squares between two lists of the same size


Topic: Write a function to calculate the residual sum of squares between two lists of the same size

Solution

def rss(lst1, lst2):
    diff = [lst1[x] - lst2[x] for x in range(len(lst1))]
    return sum(list(map(lambda x: x ** 2, diff)))



List all Python Programs