Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This function adds two numbers
- def adds(x, y, ):
- return x + y
- # This function substracts two numbers
- def substracts(x, y, ):
- return x - y
- # This function multiplies two numbers
- def multiplies(x, y, ):
- return x * y
- # This function divides two numbers
- def divides(x, y, ):
- return x / y
- def percent(x, y):
- return x % y
- def exponentiation(x, y):
- return x ** y
- while True:
- print("Welcome to Adrians crappy calculator.")
- print("Choose your math shit!")
- print("1.Adds")
- print("2.Substracts")
- print("3.Multiplies")
- print("4.Divides")
- print("5.Percent")
- print("6.Exponentiation")
- print("Infinity")
- # Take input from the user
- choice = input("Enter choice(1/2/3/4/5/6/):")
- num1 = int(input("Enter first number: "))
- num2 = int(input("Enter second number: "))
- if choice == '1':
- print(num1, "+", num2, "=", adds(num1, num2, ))
- elif choice == '2':
- print(num1, "-", num2, "=", substracts(num1, num2, ))
- elif choice == '3':
- print(num1, "*", num2, "=", multiplies(num1, num2, ))
- elif choice == '4':
- print(num1, "/", num2, "=", divides(num1, num2, ))
- elif choice == '5':
- print(num1, "%", num2, "=", percent(num1, num2))
- elif choice == '6':
- print(num1, "", num2, "=", exponentiation(num1, num2))
- elif choice == 'Infinity':
- print("Ur mom gay")
- else:
- print("Invalid input moron")
- reply = input('Do you wanna quit nerd?: ')
- if reply == 'Yes':
- break
- if reply == 'Si':
- break
- if reply == 'yes':
- break
- if reply == 'Ja':
- break
- if reply == 'ja':
- break
- if reply == 'y':
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement