我正在为我的决赛制作一个二进制计算器,但我的程序不管用户输入如何都会继续使用if语句。我的编译器没有识别任何语法错误。请帮忙
#This asks the user to input a binary number. also converts it to decimal for operation.
inp = input("Enter a Binary number: ")
dec = int(inp, 2)
inp1 = input("Enter another Binary number: ")
dec1 = int(inp1, 2)
#selection of arithmetic operation
print("A = Addition")
print("S = Subtraction")
print("M = Multiplication")
print("D = Division")
arith = input("Select an Arithmetic Operation: ")
#list of operations depending on which operation is chosen
if (arith == 'A' or 'a'):
add = (dec+dec1)
conv = bin(add)
print("Your result after Adding", inp, "and", inp1, "is", conv)
print("Decimal: ", dec, "+", dec1, "=", add)
elif (arith == 'B' or 'b'):
sub = (dec-dec1)
conv1 = bin(sub)
print("Your result after Subtracting", inp, "and", inp1, "is", conv1)
print("Decimal: ", dec, "-", dec1, "=", sub)
elif (arith == 'M' or 'm'):
mul = (dec*dec1)
conv2 = bin(mul)
print("Your result after Multiplying", inp, "and", inp1, "is", conv2)
print("Decimal: ", dec, "x", dec1, "=", mul)
elif (arith == 'D' or 'd'):
div = (dec/dec1)
conv3 = bin(div)
print("Your result after Dividing", inp, "and", inp1, "is", conv3)
print("Decimal: ", dec, "/", dec1, "=", mul)
else:
print("That is not a valid operation.")