# By Brian Gross # # 4/19/11 # # Demonstrates a function and its practical use # from time import sleep answer = raw_input('Would you like me to do the four functions? ') if answer=="yes" or answer=="y" or answer=="sure" or answer=="okay": def Division(one,two): print ' ','%s / %s' % (one,two) print ' ','=' * 10 print float(one)/float(two) a = raw_input('Please enter a number ') b = raw_input('Please enter another one ') Division(a,b) print '\n' def Multiplication(one,two): print ' ','%s * %s' % (one,two) print ' ','=' * 10 print float(one)*float(two) Multiplication(a,b) print '\n' def Addition(one,two): print ' ','%s + %s' % (one,two) print ' ','=' * 10 print float(one)+float(two) Addition(a,b) print '\n' def Subtraction(one,two): print ' ','%s - %s' % (one,two) print ' ','=' * 10 print float(one)-float(two) Subtraction(a,b) elif answer=="no" or answer=="n": a = 'fine!' print a.upper() exit() else: print 'Invalid Command.' exit() # print a*b would not work I think because they werent numbers # # Tutorial on how to define a function from -- http://www.youtube.com/watch?v=y_2uy1TOH1M&feature=relmfu #