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

1 answer below »
pfa


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 Sorry, ‘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 Sorry, ‘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 Sorry, ‘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 AfterMar 13, 2021

Answer To: Assignment4 Write a program that asks a user to enter a starting value. Then the program will ask...

Devanshu answered on Mar 23 2021
150 Votes
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 n
umber. 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
Sorry, ‘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
Sorry, ‘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

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here