# Untitled

unknown
python
2 years ago
1.5 kB
3
Indexable
Never
```from calc_logo import logo

# Calculator
return n1 + n2

def subtract(n1, n2):
return n1 - n2

def multiply(n1, n2):
return n1 * n2

def divide(n1, n2):
return n1 / n2

def exponentiation(n1, n2):
return n1 ** n2

operations = {
"-": subtract,
"*": multiply,
"/": divide,
"**": exponentiation

}

def get_first_input():
num1 = input("What's the first number?: ")
try:
return float(num1)
except:
print("Invalid data, given number must be an integer or a float you jackass!")
get_first_input()

def get_second_input():
num2 = input("What's the next number?: ")
try:
return float(num2)
except:
print("Invalid data AGAIN dumbass, given number must be an integer or a float!")
get_second_input()

def my_calculator():
print("Welcome to Marta's calculator!")
print(logo)
num1 = get_first_input()

for symbol in operations:
print(symbol)

flag = True

while flag:
operation_symbol = input("Pick an operation: ")
num2 = get_second_input()
calculation_function = operations[operation_symbol]