JunkieHF

Very Simple Python Calculator

Dec 27th, 2014
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. def Addition():
  2. x = int(raw_input("first number: "))
  3. y = int(raw_input("second number: "))
  4. print 'Your result is: ' + str(x+y)
  5. raw_input("press enter to exit")
  6.  
  7. def subtraction():
  8. x = int(raw_input("first number: "))
  9. y = int(raw_input("second number: "))
  10. print 'Your result is: ' + str(x-y)
  11. raw_input("press enter to exit")
  12.  
  13. def multiply():
  14. x = int(raw_input("first number: "))
  15. y = int(raw_input("second number: "))
  16. print 'Your result is: ' + str(x*y)
  17. raw_input("press enter to exit")
  18.  
  19. def divide():
  20. x = int(raw_input("first number: "))
  21. y = int(raw_input("second number: "))
  22. print 'Your result is: ' + str(x/y)
  23. raw_input("press enter to exit")
  24.  
  25. choice = int(raw_input("Press 1 for addition, 2 for subtraction, 3 for multiplication, or 4 for division: "))
  26. if choice == 1:
  27. Addition()
  28. elif choice == 2:
  29. subtraction()
  30. elif choice == 3:
  31. multiply()
  32. elif choice == 4:
  33. divide()
  34. else:
  35. print 'Invalid Selection'
Add Comment
Please, Sign In to add comment