Ok. This IS homework ...
Sat Oct 14 19:09:49 EDT 2006
"spawn" <evilrottenspawn at gmail.com> writes:
> That's not the problem, in fact, that part works. It's the adding
> that isn't working. How can my program add 2 + 7 and come up with 14?
> while running:
> guess = int(raw_input('I\'ll need another number : '))
> running_total = guess + subtotal
> print running_total
You are never modifying the running total. I think you want to
initialize the running total to the first guess outside the loop, then
add guess to it when you read a new number. You can add to a variable
running_total += guess
this is approx. the same thing as
running_total = running_total + guess
I don't think subtotal and running_total need to be separate variables.
More information about the Python-list