Question: write a program that emulates a calculator:In python 1 . Multiplication 2 . Division 3 . Addition 4 . Subtraction 5 . Quit Display a

write a program that emulates a calculator:In python
1. Multiplication
2. Division
3. Addition
4. Subtraction
5. Quit
Display a menu where the user would select his choice by typing a number. If the user types an invalid choice, then display a msg error
The user input are float numbers
Format your output (floating number) to 2 digits after the '.'(.2f)
Treat the exception where a user type 0(zero) to divide by
Helpful HINTs:
1. If you do not cast/convert your input (i.e., choice) data type to an int, then
it will be read as a character. Thus, you will have to compare it to a
character and not to an int!
choice = input(choice : )
use [if (choice ==1) :] #instead of [if (choice ==1)]
2. For calculating the input (a, b), make sure you cast your input type to a
float data type when reading input, otherwise your input will be read as a
character
= float(input(Enter a: )

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!