My homework assignment is to calculate the sum of a series of numbers inputted by the user using a 'For Loop', but I can't seem to successfully add the input numbers.
I have tried printing the variable that holds the amount of numbers the loop repeats, and using things like "1 + 2 + 3 + 4 + 5", but it either prints every time the code loops, or it prints "15", for example. This is the code:
listo = (1,2,3,4,5)
for num in range(len(listo)) :
float(input("Enter a number: "))
krab = #This is where I'm struggling, as I don't know how to add the inputted numbers.
print "Your total sum is" , krab
The output should be the sum of each time it loops, so if the inputted numbers are, for example, 5 through 10, the program should print "35".
1 + 2 + 3 + 4 + 5?