I thought your program looked wrong from the screenshot, but just to be sure I wrote it out and ran it.
Running your code as it is, I get the following output from Python:
Please do not use zero as a number!
Traceback (most recent call last):
File "bmicalc.py", line 28, in <module>
body_mass_index = (get_weight * 703) / (get_height ** 2)
ZeroDivisionError: float division by zero
The reason that we’re getting this specific error in the traceback is because you’ve declared your variables,
get_weight and assigned them the value of
0.0 in both cases.
Immediately after assigning zero values to your variables, you’re attempting to calculate the BMI using them within your
try statement. This throws the expected ZeroDivisionError which is caught by the
except statement, and we get the right output to the console of “Please do not use zero as a number!”.
We handled the exception, so Python carries on.
There’s then two more functions defined,
get_users_info(), but the next line that Python runs is here:
#user will enter their information above and we will then calculate.
body_mass_index = (get_weight * 703) / (get_height ** 2) # this is the next line to run!
We still haven’t assigned either of the
get_weight variables a value which is non-zero, but this time our divide-by-zero calculation isn’t sat nicely in a
try statement so Python bails and throws your error at you.
Hopefully that make sense and you can see why you’re getting that particular error in this case.
There are a couple of other things in your code that will keep it from working, but I’m going to keep this post just covering the specific error you asked about.