I have to program a simple calculator, i had all of my functions working seperatly but now that they are all together the add and the average won't compute. The problems started when i tried to get the program to loop back to the menu after you get a total. Any help would be greatly appreciated. i tried to upload my code but it failed so i just added it on to this post. thanks for the help!

print" welcome to python calculator"
print
print" choose an option:"
print
print"2 subtract"
print"3 Multiply"
print"4 divide"
print"5 mod"
print"6 average"
print"7 exit"

sum = 0.0
number = 1
while number !=0:
print "Enter 0 to exit loop"
number = input("Enter a number: ")
if number !=0:
sum = sum + number
print "equals: ", sum + number
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
difference = integer1 - integer2
print" Difference is \a ",difference
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
product = integer1 * integer2
print" Product is \a ",product
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
quotient = integer1 / integer2
print" Quotient is \a ",quotient
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
mod = integer1 % integer2
print" Mod is \a ",mod
count = 0
sum = 0.0
number = 1
print "Enter 0 to exit the loop"
while number !=0:
number = input("enter a number:")
if number !=0:
count = count + 1
sum = sum + number
print "The average was:",float (sum) / count

Why is there no indentation at all? This. Is. Madness!

Why is there no indentation at all? This. Is. Madness!

for Python on Daniweb:
Please use the [code=python] and [/code] tag pair to enclose your python code.

further:
look at the light gray message in the post entry field for the forum

I made a few modifications to your code, used functions and a loop, test it out ...

``````# simple calculator

print '-'*40
print" welcome to python calculator"
print
print" choose an option:"
print
print"2 subtract"
print"3 Multiply"
print"4 divide"
print"5 mod"
print"6 average"
print"7 exit"

sum = 0.0
number = 1
while number !=0:
print "Enter 0 to exit loop"
number = input("Enter a number: ")
if number !=0:
sum = sum + number
print "equals: ", sum + number
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
difference = integer1 - integer2
print" Difference is \a ",difference
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
product = integer1 * integer2
print" Product is \a ",product
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
quotient = integer1 / integer2
print" Quotient is \a ",quotient
integer1 = raw_input( "enter first integer: \n")
integer1 = int(integer1)
integer2 = raw_input( "enter second integer: \n")
integer2 = int(integer2)
mod = integer1 % integer2
print" Mod is \a ",mod
count = 0
sum = 0.0
number = 1
print "Enter 0 to exit the loop"
while number !=0:
number = input("enter a number:")
if number !=0:
count = count + 1
sum = sum + number
print "The average was:",float (sum) / count

# the program loop
while True: