Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
