Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. # This function adds two numbers
  2. def adds(x, y, ):
  3. return x + y
  4. # This function substracts two numbers
  5.  
  6. def substracts(x, y, ):
  7. return x - y
  8. # This function multiplies two numbers
  9.  
  10. def multiplies(x, y, ):
  11. return x * y
  12. # This function divides two numbers
  13.  
  14. def divides(x, y, ):
  15. return x / y
  16.  
  17. def percent(x, y):
  18. return x % y
  19.  
  20. def exponentiation(x, y):
  21. return x ** y
  22.  
  23. while True:
  24. print("Welcome to Adrians crappy calculator.")
  25. print("Choose your math shit!")
  26. print("1.Adds")
  27. print("2.Substracts")
  28. print("3.Multiplies")
  29. print("4.Divides")
  30. print("5.Percent")
  31. print("6.Exponentiation")
  32. print("Infinity")
  33. # Take input from the user
  34. choice = input("Enter choice(1/2/3/4/5/6/):")
  35.  
  36. num1 = int(input("Enter first number: "))
  37. num2 = int(input("Enter second number: "))
  38.  
  39. if choice == '1':
  40. print(num1, "+", num2, "=", adds(num1, num2, ))
  41.  
  42. elif choice == '2':
  43. print(num1, "-", num2, "=", substracts(num1, num2, ))
  44.  
  45. elif choice == '3':
  46. print(num1, "*", num2, "=", multiplies(num1, num2, ))
  47. elif choice == '4':
  48. print(num1, "/", num2, "=", divides(num1, num2, ))
  49. elif choice == '5':
  50. print(num1, "%", num2, "=", percent(num1, num2))
  51. elif choice == '6':
  52. print(num1, "", num2, "=", exponentiation(num1, num2))
  53. elif choice == 'Infinity':
  54. print("Ur mom gay")
  55. else:
  56. print("Invalid input moron")
  57.  
  58. reply = input('Do you wanna quit nerd?: ')
  59.  
  60. if reply == 'Yes':
  61. break
  62. if reply == 'Si':
  63. break
  64. if reply == 'yes':
  65. break
  66. if reply == 'Ja':
  67. break
  68. if reply == 'ja':
  69. break
  70. if reply == 'y':
  71. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement