Commit 360845e8 authored by Gilles Coremans's avatar Gilles Coremans
Browse files

Do better error handling on inputs

parent 959961e1
operand1 = int(input("First operand: "))
operand1 = input("First operand: ")
operator = input("Operator: ")
operand2 = int(input("Second operand: "))
operand2 = input("Second operand: ")
try:
operand1 = int(operand1)
except ValueError:
print(operand1 + " is not a number!")
exit(1)
try:
operand2 = int(operand1)
except ValueError:
print(operand1 + " is not a number!")
exit(1)
print("Your result is:")
if operator == "+":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment