Question: For this lab your goal will be to modify a program that calculates two operands given the supplied operator. The program that you must modify
For this lab your goal will be to modify a program that calculates two operands given the supplied operator. The program that you must modify can be downloaded from here Download here.
The labpy code implements a simple command line calculator that runs in the shell similar to what you may have created in lab Unfortunately, this calculator raises an exception and traceback when the following inputs are used:
Enter left operand:
Enter right operand:
What type of calculation would you like to perform x
and
Enter left operand:
Enter right operand:
What type of calculation would you like to perform x
These inputs are not the only values that can cause an exception, but they demonstrate the two different types of exceptions that go unhandled in the current code. You must modify the program so that these conditions no longer raise exceptions.
You are free to fix the calculator however you want, but you must complete the following requirements:
Identify and handle two different types of exceptions using tryexcept statements.
Organize your code so the program will notify the user of the error and continue accepting input.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
