Medical Insurance Project

Hello! I’m on the medical insurance project of Python functions.

Maria’s estimated cost should be displaying, but all I’m getting is Omar’s. Any help to ID what I did wrong be much appreciated!

Create calculate_insurance_cost() function below:

def calculate_insurance_cost():
estimated_cost = 1000
print(“The estimated insurance cost for this person is " + str(estimated_cost) + " dollars.”)
return estimated_cost

def calculate_insurance_cost(age, sex, bmi, num_of_children, smoker):
estimated_cost = 250age - 128sex + 370bmi + 425num_of_children + 24000*smoker -12500

Initial variables for Maria

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

Estimate Maria’s insurance cost

maria_insurance_cost = calculate_insurance_cost(age = 28, sex = 0, bmi = 26.2, num_of_children = 3, smoker = 0)

Initial variables for Omar

age = 35
sex = 1
bmi = 22.2
num_of_children = 0
smoker = 1

Estimate Omar’s insurance cost

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

print(“The estimated insurance cost for Omar is " + str(insurance_cost) + " dollars.”)

Please format your code:

What is the link to the lesson?
Also, you have the name Omar hardcoded into the last print() statement, so, that’s what will print.

Also, I thought that when you defined the function, calculate_insurance_cost, that one of the parameters is name, so that way, you can pass through any name and the function logic will be applied. Right?

ex:

Summary
def calculate_insurance_cost(name, age, sex, bmi, num_of_children, smoker):
  estimated_cost = 250*age - 128*sex + 370*bmi + 425*num_of_children + 24000*smoker - 12500
  
  print("The estimated insurance cost for " + name + " is "   + str(estimated_cost) + " dollars. ")
  
  return estimated_cost

maria_insurance_cost = calculate_insurance_cost(name = "Maria", age = 28, sex = 0, bmi = 26.2, num_of_children = 3, smoker = 0)