IssacX

Calculator

Apr 11th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. #Coded by IssacX
  2. #####################
  3. #+------+----------+#
  4. #|Python|Calculator|#
  5. #+------+----------+#
  6. #####################
  7.  
  8. import math
  9.  
  10. print """
  11. Calculator coded by IssacX
  12. #####################
  13. #+------+----------+#
  14. #|Python|Calculator|#
  15. #+------+----------+#
  16. #####################
  17. """
  18. def calculate():
  19.     process = raw_input("Are you going to: Add, Subtract, Multiply, or Divide?\n>")
  20.     if process== "add":
  21.         def add():
  22.             print("Enter two Numbers\n")
  23.             a = int(raw_input('A = '))
  24.             b = int(raw_input('B = '))
  25.             c = a + b
  26.             print ('C = %s' %c)
  27.         add()
  28.     elif process == "subtract":
  29.         def sub():
  30.             print("Enter two Numbers\n")
  31.             a = int(raw_input('A = '))
  32.             b = int(raw_input('B = '))
  33.             c = a - b
  34.             print ('C = %s' %c)
  35.         sub()
  36.     elif process == "multiply":
  37.         def mul():
  38.             print("Enter two Numbers\n")
  39.             a = int(raw_input('A = '))
  40.             b = int(raw_input('B = '))
  41.             c = a * b
  42.             print ('C = %s' %c)
  43.         mul()
  44.     elif process == "divide":
  45.         def mul():
  46.             print("Enter two Numbers\n")
  47.             a = int(raw_input('A = '))
  48.             b = int(raw_input('B = '))
  49.             c = a / b
  50.             print ('C = %s' %c)
  51.         mul()
  52.     calculate()
  53. calculate()
Advertisement
Add Comment
Please, Sign In to add comment