I just started python yesterday so I was trying to make this python code to make a calculator that adds, multiplies, divides, and subtracts. When I started testing the code just wasn't working even though I did similar things and to me, the code looked right this is the code:
op =input("which operation would you like to use (type m for multiply d for divide s for subtract a for addition): ")
first_number =float(input("please enter your first number: "))
second_number =float(input("please enter your second number: "))
if op.upper()=="m" or op.lower()=="m":
print("multiply")
elif op.upper()=="d" or op.lower()=="d":
print("divide")
elif op.upper()=="s" or op.lower()=="s":
print("subtract")
elif op.upper()=="a" or op.lower()=="a":
print("addition")
else:print("the operation you entered is not available")
I was expecting it to take input and based on this it would know what operation I wanted to make but this is the error I got:
elif op.upper()=="d" or op.lower()=="d":
^
IndentationError: unindent does not match any outer indentation level
This should resolve the indentation error.
op =input("which operation would you like to use (type m for multiply d for divide s for subtract a for addition): ")
first_number =float(input("please enter your first number: "))
second_number =float(input("please enter your second number: "))
if op.upper()=="m" or op.lower()=="m":
print("multiply")
elif op.upper()=="d" or op.lower()=="d":
print("divide")
elif op.upper()=="s" or op.lower()=="s":
print("subtract")
elif op.upper()=="a" or op.lower()=="a":
print("addition")
else:
print("the operation you entered is not available")