Ok. This IS homework ...



but I've been struggling with this for far too long and I'm about to
start beating my head against the wall.

My assignment seemed simple: create a program that will cacluate the
running total of user inputs until it hits 100. At 100 it should stop.
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?

I'm posting my code (so that you may all laugh). If ANYONE has any
ideas on what I'm doing wrong, I'd appreciate.

---------------------------------------------------

running = True
goal = 100

# subtotal = 0
# running_total = subtotal + guess

while running:
guess = int(raw_input('Enter an integer that I can use to add : '))
subtotal = guess

while running:
guess = int(raw_input('I\'ll need another number : '))
running_total = guess + subtotal
print running_total

if running_total == goal:
print 'Congratulations! You\'re done.'

elif running_total > goal:
print 'That\'s a good number, but too high. Try again.'

print 'Done'

--------------------------

I tried adding an additional "while" statement to capture the second
number, but it didn't seem to solve my problem. Help!

.



Relevant Pages

  • Re: LRC Calculation Algorithm
    ... > Your head must be quite swollen from beating it against the wall. ... > don't you heed the advice given and ask the question in an ...
    (microsoft.public.vb.enterprise)
  • Re: IBM Thinkpad install
    ... quite beating my head against that wall. ... , PEER, the IDE drivers, yap, yap, it is simply not worth it to go any ...
    (comp.os.os2.setup.misc)
  • Re: Clear a combo box on error?
    ... I've been beating my head against the wall and I ... Prev by Date: ...
    (comp.databases.ms-access)
  • Re: Help with HtmlTextWriter
    ... Try UrlEncode the link. ... >I have been beating my head against a wall for two days now. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Fission rockets for missiles
    ... "Or went on," Earl said suddenly from the corner where he was studying the conference room wall display. ... It was the same team Mei-ling had taken groundside on Kaybeck. ... She lifted her head and looked straight into the pickup. ...
    (rec.arts.sf.science)