# Need Help

Hi All,
im completely new in Programming and stuck already at the beginning from my carrier path.Please see code below and my Outputs from this Code.I dont get an error but the Outputs which are expected are not the same with my outputs:

# create the initial variables below

age = 28 # Age of the individual in years

sex = 0 # 0 for female

bmi = 26.2 # Individual’s body mass index

num_of_children = 3 # Number of children the individual has

smoker = 0 # 0 for a non-smoker

# Add insurance estimate formula below

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.”)

# Age Factor

age += 4

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 insurance cost is by +4 Age " + str(change_in_insurance_cost) + " dollars.”)

# BMI Factor

age -= 4

bmi += 3.1

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

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 - 1250

change_in_insurance_cost = new_insurance_cost - insurance_cost

print(“The change in estimated cost for being male instead if female is " + str(change_in_insurance_cost) + " dollars.”)

My Outputs from this code are:
This person’s insurance cost is 5469.0 dollars.
The change in insurance cost is by +4 Age 1000.0 dollars.
The change in estimated insurance cost after increasing BMI by 3.1 is 12397.0 dollars.
The change in estimated cost for being male instead if female is 13416.0 dollars.

It Should be like that:
The change in estimated insurance cost after increasing BMI by 3.1 is 1147.0 dollars.
The estimated cost associated with being female instead of male is -128.0 dollars.

your help is higly appriciated.

If you paste code directly into the forums, formatting is lost which makes it difficult to read code.

To preserve code formatting in forum posts, see: [How to] Format code in posts

There are two issues which are resulting in your output being different than the expected output mentioned by you.

• Issue #1. You wrote `1250` instead of `12500` in two statements.
``````# You wrote:
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 *
num_of_children + 24000 * smoker - 12500

# But later, in two of your statements you wrote:
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 *
num_of_children + 24000 * smoker - 1250
``````
• Issue #2. In the Male vs. Female Factor section, you wrote `bmi += 3.1` instead of `bmi -= 3.1`
``````# In BMI Factor section you wrote
bmi += 3.1
# which is fine.

# But in the Male vs. Female Factor section, you want to undo the earlier change.
# In this section, it should be:
bmi -= 3.1
# so that the earlier change to bmi is undone allowing sex to be the only change.
``````

2 Likes