You could try converting to floats before you go to resolve the expression. If someone enters "potato" for num1 the program will still ask for num2 and operation before throwing an error later on. This would also make the test of the code read easier.
You also are not catching division by zero errors which is fine because the program is ending anyway, but as a programmer you should think about what exceptions could be raised when you write code.
View all comments
2
u/Ceteris__Paribus 21h ago
You could try converting to floats before you go to resolve the expression. If someone enters "potato" for num1 the program will still ask for num2 and operation before throwing an error later on. This would also make the test of the code read easier.
You also are not catching division by zero errors which is fine because the program is ending anyway, but as a programmer you should think about what exceptions could be raised when you write code.