# Simple Console Calculator App in Python 3
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
if y == 0:
return "Error! Division by zero."
else:
return x / y
def power(x, y):
return x ** y
print("Welcome to the Simple Calculator App")
while True:
print("\nOptions:")
print("Enter 'add' for addition")
print("Enter 'subtract' for subtraction")
print("Enter 'multiply' for multiplication")
print("Enter 'divide' for division")
print("Enter 'power' for exponentiation")
print("Enter 'quit' to exit the application\n")
user_input = input("What would you like to do? ").lower()
if user_input == "quit":
print("Thank you for using the Simple Calculator App. Goodbye!")
break
# Ask for numbers
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
if user_input == "add":
print("The result is:", add(num1, num2))
elif user_input == "subtract":
print("The result is:", subtract(num1, num2))
elif user_input == "multiply":
print("The result is:", multiply(num1, num2))
elif user_input == "divide":
print("The result is:", divide(num1, num2))
elif user_input == "power":
print("The result is:", power(num1, num2))
else:
print("Invalid input, please choose a valid operation.")
Then, you can follow the on-screen instructions to use the calculator. Enter the operation you'd like to perform (add, subtract, multiply, divide, power), input your numbers, and the application will display the result. Type 'quit' when you wish to exit the application.