Assignment4
Write a program that asks a user to enter a starting value. Then the program will ask for an operation to perform on that number. The available operations are add, subtract, multiply, and division. The program will make sure a valid operation is selected. If there is not a valid operation chosen, then the program will notify the user and keep asking. When a valid operation is chosen then the user is asked to enter a number to perform the operation.The result of the operation is output to the screen and the user is prompted to enter the next operation to perform on the result followed by the value to use. The program will continue until a sentinel value of -999 is input.
Below is the input/output that you are to use.
Enter your starting number: -157
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on -157 or enter -999 to end: add
So
y, â€˜addâ€™ is not a valid operation. Try Again!
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on -157 or enter -999 to end: Add
So
y, â€˜Addâ€™ is not a valid operation. Try Again!
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on -157 or enter -999 to end: A
Add -157 with what value: 357
The result is 200
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on 200 or enter -999 to end: divide
So
y, â€˜divideâ€™ is not a valid operation. Try Again!
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on 200 or enter -999 to end: Divide
Divide 200 with what value: 100
The result is 2
Enter A for Add, S for Subtract, M for multiply, or D for Divide to perform on 200 or enter -999 to end:-999
Program ended with a result of 2
Comment your source code and describe your code to someone who may be viewing it for the first time.
PLACE SCREEN SHOTS OF THE PYTHON CODE AND ALL I/O BELOW.