I have a homework problem that I cant figure out, can someone help(adsbygoogle = window.adsbygoogle || []).push({});

--Create a function called sums that will prompt the user to enter integer values (either positive or negative). The function should keep separate running totals of the positive values and the negative values. The user should be allowed to continue entering values until he/she enters a zero to stop.

Here's what I got and it doesn't work

it just runs the loop under the first iteration, I'm confused as to what to do to correct itCode (Text):

number=int(raw_input("Enter and a positive or negative integer: "))

def sums(number):

while (number>0):

posnumber= int(raw_input("Enter another number or 0 to quit: " ))

number=number+posnumber

print "The positive total is", number

while (number<0):

negnumber=int(raw_input("Enter another number or 0 to quit: " ))

number=number+negnumber

print "The negative total is", number

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Python loops with running total

**Physics Forums | Science Articles, Homework Help, Discussion**