I'm trying to solve the math problem in exercise 21 in Q&A, 24 + 34 / 100 - 1023
.
using functions:
def add(a, b):
print "ADD %d + %d" % (a, b)
return a + b
def subtract(a, b):
print "SUBTRACT %d - %d" % (a, b)
return a - b
def divide(a, b):
print "DIVIDE %d / %d" % (a, b)
return a / b
print "Solve 24 + 34 / 100 - 1023?"
what = subtract(add(24, divide(34,100)),1023)
print "The Answer is", what
the answer I got is -999 but when I do on calculator I got = -998.66
how to get the answer with decimal?