1. In class, we saw how we could use a for loop to calculate the sum of some numbers.
Each of the following loops is an attempt to sum up the numbers from 1 to n (you
can assume n is initialized to some value). For each case, explain why this doesn't actually
sum the numbers 1 through n.
a.
sum = 0
for i in range(n):
sum = sum + i
b.
sum = 0
for i in range(n):
temp = sum + (i+1)
sum = temp
c.
sum = 0
for i in range(n):
sum = (i+1)
d.
sum = 0
for i in range(n):
temp = (i+1)
sum = temp