Question: 4. Write a python program named calculator.py to simulate a simple calculator. Your program should ask your user for two numbers and the operation the

4. Write a python program named calculator.py to simulate a simple calculator. Your program should ask your user for two numbers and the operation the user wants to apply on the given numbers. Allow your users to input

a. + or a to indicate the addition,

b. - or s to indicate the subtraction,

c. * or m to indicate the multiplication,

d. / or d to indicate the division,

e. % or r to indicate the remainder,

f. ^ or p to indicate the power of operation.

Your program's output should look something like this: Enter two numbers: 5, 2 Enter the operation: p Result: 5^2 = 25

Note: the user should enter the two numbers together in the same line (as shown above) Note: your operations should work whether the user enters the appropriate letter or symbol. Note: In the division operation, you should print an error message if the user enters a zero as the divisor operand (as shown in the sample output below)

Enter two numbers: 5, 0 Enter the operation: / Cannot compute! The divisor operand should not be zero!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!