Purpose is to put diff ages in, if -1 is entered then the program stops, my totaling statement is wrong. Will Someone please help me fix it.
Totalage = 0
age = 0
print "Enter you Family member's ages!"
age = raw_input ("Enter an age ")
while age != -1:
age = input("Enter an age ")
Totalage = Totalage + age
print Totalage
There are two problems with your code
-1to your Total.Just Change the order of the statements in your while loop
Also note,
raw_input, in general returns a string, which needs to be converted to int before you may want to calculate on it.Itertools Provide some wonderful tools, and for fun, I tried coding the above while loop with
itertools.takewhile