Medical Insurance Project

Greetings Friends!
I’m working on the Medical Insurance Project in the Data Science Career Path.

I’m running into a problem at Task 11.
I’ve changed the binary value of sex from 0 to 1.
Task 12 says I should have outputted a negative value for change_in_insurance_cost after completing Task 11; however, I received a positive value…
…and I told my vocational counsellor that I’d be done with the project by day’s end…
Can someone please help me figure out where I’m going wrong?

Here’s what my program looks like:

create the initial variables below

age = 28
sex = 0
bmi = 26.2
num_of_children = 3
smoker = 0

Add insurance estimate formula below

insurance_cost = 250 * age - 128 * sex + 270 * bmi + 425 * num_of_children + 24000 * smoker - 12500

Age Factor

age += 4
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
print(“This person’s insurance cost is " + str(insurance_cost) + " dollars.”)

change_in_insurance_cost = new_insurance_cost - insurance_cost

print(“The change in cost of insurance after increasing the age by 4 years is " + str(change_in_insurance_cost) + " dollars.”)

BMI Factor

age = 28
bmi += 3.1

new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500

change_in_insurance_cost = new_insurance_cost - insurance_cost
print(“The change in estimated insurance cost after increasing BMI by 3.1 is " + str(change_in_insurance_cost) + " dollars.”)

Male vs. Female Factor

bmi -= 3.1
sex = 1

new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500

change_in_insurance_cost = new_insurance_cost - insurance_cost
print(“The change in estimated cost for being male instead of female is " + str(change_in_insurance_cost) + " dollars.”)

Extra Practice

So the BMI is 26. 2 and the sex =1, correct? (in step 10 it says to change the BMI back to 26.2 & that value is what you need for Step 11).

What number did you get in your output?

I think I changed the BMI back to 26.2.
I tried using the -= (-=3.1) operator that time around instead of redefining with = (bmi = 26.2).
…IDK, maybe I should change that…

Anyhow, this is what’s outputted:

The change in estimated cost for being male instead of female is 2492.0 dollars.

The formula should read 370 rather than 270 in this step (step2)

1 Like

AH! :rofl:
Good eye!
Thanks so much! :smiley:

1 Like

You’re welcome!
It’s always good to have a 2nd set of eyes. :slight_smile:

1 Like

Copy and paste is much quicker and easier than re-typing if that is how the error has occurred.

Glad you got it sorted anyways.

1 Like

Thanks, but for some reason I’m unable to copy or paste into or from the text editor…

This seems to be a reoccurring problem that I’ve seen here. What OS are you using and what browser?

I’m using Microsoft Edge…

That seems to be a ongoing problem with Edge.
I found this

hahahahaha I am new to coding and doing these small mistakes frequently :smiley: