Question
(Python)You will write a calculator program in Python. The operations your program must compute include, addition (+), subtraction(-), multiplication(*), division(/), integer division (//) and power(**)
(Python)You will write a calculator program in Python. The operations your program must compute include, addition (+), subtraction(-), multiplication(*), division(/), integer division (//) and power(**) operation. Given two numbers and the desired operation symbol shown in the previous sentence. Your program must match the output exactly to get full points. See the examples below. The program must exit right away if the operation is not valid. You do not need to check if the numbers entered are valid. You program will ask whether to stop and if the user enters y the program will exit, otherwise if the user enters n the program will continue.
Steps
- Create a file named calculator.py
- Inside the file create a Python 3 function called calculator
- The function should take three parameters in this order: number1, number2, operator
- The calculator function should print the result of the operation but if the operation was invalid return false
- Create another function called input_output, which will take input from the user and call the calculator function.
- The function should also ask if the user wishes to continue
Example
Enter the first number: 10 Enter the second number: 2 Enter the operation: + 12.0
Do you wish to exit? n Enter the first number: 12 Enter the second number: 4.2 Enter the operation: * 50.400000000000006
Do you wish to exit? n Enter the first number: 10 Enter the second number: 2 Enter the operation: ** 100.0
Do you wish to exit? y >>>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started