Create an algorithm in python that calculates the sum of squares of all the numbers from 1 to N.
N = 10
def sum_of_squares(n):
    result = 0
    for i in range(n+1):
        result += i**2
    return result