sum(range(0, n+1))
This is not efficient and we can do the same using the below formula.
sum_n = n*(n+1)//2