dimanche 2 août 2020

How to stop a traceback call after making a deliberate mistake?

I am making a calculator which executes only a certain number of operations, if anything else is entered it prints a reminder message. But during that process an name error occurs, just after it prints'a'. where am i going wrong?

if Operation == '+':
    c = a + b

elif Operation == '-':
    c = a - b

elif Operation == '*':
    c = a * b

elif Operation == '/':
    c = a / b
else:
    print('Read the Instructions again, dimmwit')


print('Your answer is', c)

print('Thanks! Have a great time!')

And pls give a few suggestions on how should i improve my code.

Aucun commentaire:

Enregistrer un commentaire