def sigma(z): return z * (z+1) // 2 def sigma_range(a, z): return (z * (z+1) // 2) - ((a-1) * a // 2) print(sigma(5)) print(sigma_range(1, 5))
To embed this project on your website, copy the following code and paste it into your website's HTML: