Sam wants to know what 1 + 2 + 3 + … + n comes to. Write sum_to(n) to add up 1 to n with a loop. For n of 0, return 0.
sum_to(4)→10sum_to(10)→55def sum_to(n):
total = 0
for i in range(1, n + 1):
# your code here: add i to total
pass
return total
Run tries the examples. When they look right, Submit.