Python Control Flow medical insurance project

I have writted all the code for Python Control Flow Medical Insurance Project. I don’t understand what Mistake I have done or what more code should I add to the project but it is never going to the next step`# Add your code here
def analyze_smoker(smoker_status):
print(“To lower your cost, you should consider quitting smoking.”)
print(“Smoking is not an issue for you.”)
def analyze_bmi(bmi_value):
print("Your BMI is in the obese range. To lower your cost, you should significantly lower your BMI. ")
elif(bmi_value>=25) and (bmi_value<=30):
print("Your BMI is in the overweight range. To lower your cost, you should lower your BMI. ")
elif(bmi_value>=18.5)and (bmi_value<25):
print(“Your BMI is in a healthy range.”)
print(“our BMI is in the underweight range. Increasing your BMI will not help lower your cost, but it will help improve your health.”)

Function to estimate insurance cost:

def estimate_insurance_cost(name, age, sex, bmi, num_of_children, smoker):
estimated_cost = 250age - 128sex + 370bmi + 425num_of_children + 24000*smoker - 12500
print(name + “'s Estimated Insurance Cost: " + str(estimated_cost) + " dollars.”)
except ValueError:
print(“Please use 1 for smoker, and 0 for non-smoker.”)
return estimated_cost

Estimate Keanu’s insurance cost

keanu_insurance_cost = estimate_insurance_cost(name = ‘Keanu’, age = 29, sex = 1, bmi = 26.2, num_of_children = 3, smoker = 1)


What should I do and why should I do it?

Could you add a link to the project and format the text as per the details in this FAQ: How to ask good questions and get good answers.

The syntax for the calculation in the estimate_insurance_cost function seems to be a bit off. You cannot multiply a number and the value referenced by a name by combining the number with the name, 250age for example would throw an error.

Have you tested that all these functions actually run as you expect? Try calling them with a few different values to test if you are unsure.

1 Like