Question: Overview You will write a program that will use a while loop to prompt a user for first _ num and second _ num, divide

Overview
You will write a program that will use a while loop to prompt a user for first_num and second_num, divide first_num by second_num and store the result in a variable called answer, and then print it out cleanly. Your program should handle the divide by zero error (and no other errors) and should make use of a try-execept-else block. It should continue until the user enters a 'q'.
Expected Output
Example 1
What is the first number? (or type q to quit)5
What is the second number? 90
5/90 is 0.05555555555555555
What is the first number? (or type q to quit)3
What is the second number? 0
You cannot divide by zero
What is the first number? (or type q to quit)55
What is the second number? 10
55/10 is 5.5
What is the first number? (or type q to quit) q
The program is over
Specifications
You should submit a single file called M8A3.py
It should follow the submission standards outlined here: Submission Standards
Your program must use a while-loop to collect user input until the user enters 'q'.
Your program must store the user input in variables called first_num and second_num and must store the calculation in a variable named answer.
Your program must catch the error of dividing by zero only using a try-excecpt-else block
Tips and Tricks
Besides the error handling casting is key to this one. Make sure you are converting variables to the type you need when you need it.
Hard-Coded
Nothing is hard-coded for this file

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!