Plutonic Rainbows

Math Functions 2

Some more math functions in Python. Make sure you use your # -*- coding: utf-8 -*- or the formatting will not work correctly.

# -*- coding: utf-8 -*-
def add(a, b, c):
	print "\nADDING %d + %d + %d" % (a, b, c)
	return a + b + c
 	
price = add(12, 12, 12);print "The price is £{0:.2f}\n".format (price)
 
def multiply(a, b):
	print "MULTIPLYING %d * %d" % (a, b)
	return a * b
 	
multiply_price = multiply(10, 10);print "The price is £{0:.2f}\n".format (multiply_price)
 
def subtracting(a, b):
	print "SUBTRACTING %d - %d" % (a, b)
	return a - b
 
subtract_price = subtracting(100, 50);print "The price is £{0:.2f}\n".format (subtract_price)

def division(a, b):
	print "DIVIDING %d / %d" % (a, b)
	return a / b

division_price = division(90, 2);print "The price is £{0:.2f}\n".format (division_price)