I was loooking over some Beginner python stuff A LOT recently cause i'm interested and it seems like a lot of people's first project is something simple like a calculator. Except i'm struggling and IDK what I even did.. I've looked over other calculators online and it looks like i've done nothing wrong? It always skips to the else and doesn't even consider the elif's I don't think. or I did the functions wrong or something. Pls help.
Code:
Output:
Code:
Code
print ("Welcome to Disinterested's first calculator.")
#first define the functions
#addition
def addition(x, y):
return x + y
#subtraction
def subtraction(x, y):
return x - y
#multiplication
def multiplication(x, y):
return x * y
#division
def division(x, y):
return x / y
print ("What would you like to use?")
print ("1. Addition")
print ("2. Subtraction")
print ("3. Multiplication")
print ("4. Division")
decision = int(input("Enter your decision (1/2/3/4): "))
number1 = int(input("Enter first number: "))
number2 = int(input("Enter second number: "))
if decision == '1':
print (number1," + ",number2," = ", addition(number1, number2))
elif decision == '2':
print (number1," - ",number2," = ", subtraction(number1, number2))
elif decision == '3':
print (number1," * ",number2," = ", multiplication(number1, number2))
elif decision == '4':
print (number1," / ",number2," = ", division(number1, number2))
else:
print ("WTF ARE YOU DOING WRONG")Output:
Code
Welcome to Disinterested's first calculator.
What would you like to use?
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your decision (1/2/3/4): 4
Enter first number: 1
Enter second number: 1
WTF ARE YOU DOING WRONG
