Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago