Advertisement
Guest User

Calc

a guest
Oct 15th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. def add():
  2. a = int(input("Enter the first number you'd like to add"))
  3. b = int(input("Enter the second number you'd like to add"))
  4. c = a + b
  5. print(f"The result is {c}!")
  6.  
  7. def sub():
  8. a = int(input("Enter the first number you'd like to subtract"))
  9. b = int(input("Enter the second number you'd like to subtract"))
  10. c = a - b
  11. print(f"The result is {c}!")
  12.  
  13. def mult():
  14. a = int(input("Enter the first number you'd like to multiply"))
  15. b = int(input("Enter the second number you'd like to multiply"))
  16. c = a * b
  17. print(f"The result is {c}!")
  18.  
  19. def divis():
  20. a = int(input("Enter the first number you'd like to divide"))
  21. b = int(input("Enter the second number you'd like to divide"))
  22. c = a / b
  23. print(f"The result is {c}!")
  24.  
  25. for i in range(4):
  26. calc_mode = int(input("Please pick a mode" + "\n"
  27. "1 is addition\n"
  28. "2 is subtraction\n"
  29. "3 is multiplication\n"
  30. "4 is division\n"))
  31. if calc_mode == 1:
  32. add()
  33. elif calc_mode == 2:
  34. sub()
  35. elif calc_mode == 3:
  36. mult()
  37. elif calc_mode == 4:
  38. divis()
  39. elif i == 3:
  40. print("Shutting down.")
  41. else:
  42. print("You didn't pick a mode, try again.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement