Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# 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...

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 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.
Answered 10 days After Mar 13, 2021

## Solution

Devanshu answered on Mar 23 2021
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 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:...
SOLUTION.PDF