whenever i run this and enter an operator i get my else statement error Error: Unknown operator
# Scientific calculator
Standard_Scientific: str = input("would you like to use a standard or a Scientific calculator? ")
if Standard_Scientific == 'standard'.lower():
num1 = int(input('Enter your first number: '))
num2 = int(input('Enter your second number: '))
op = (input('Enter the operator you would like to use: '))
if op == '+ ':
print(f'{num1} {op} {num2} = {num1 + num2}')
elif op == '- ':
print(f'{num1} {op} {num2} = {num1 - num2}')
elif op == '* ':
print(f'{num1} {op} {num2} = {num1 * num2}')
elif op == '/ ':
print(f'{num1} {op} {num2} = {num1 / num2}')
else:
print('Error: Unknown operator')
elif Standard_Scientific == 'Scientific'.lower():
print("Coming soon!")
Aucun commentaire:
Enregistrer un commentaire