Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to write a BMI program in PYTHON and was having issues. The code works perfectly fine, but I want the code to issue

I'm trying to write a BMI program in PYTHON and was having issues. The code works perfectly fine, but I want the code to issue an error message as oppose to a traceback or error. For example, if I put 0 for the height, I want the message to appear, "Sorry, height cannot be 0. Please try again." I've tried to use try/except and raise but regardless, no error message will pop up besides the traceback. if input1 == 'imperial': heightIN = float(input('Input your height in Inches (in): ')) weightLB = float(input('Input your weight in Pounds (lbs):' )) BMI = round(((weightLB/(heightIN*heightIN))*703), 2) 

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

Students also viewed these Databases questions