Answered step by step
Verified Expert Solution
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
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