My code in Python does not give me the output

Hi, i got this code but do not print the message i want.

def calculate_insurance_cost(age, sex, bmi, num_of_children, smoker):

estimated_cost = 50age - 128sex + 370bmi + 425num_of_children + 24000*smoker - 12500

print("The estimated insurance cost for this person is “+ str(estimated_cost)+ " dollars”)

return estimated_cost

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

omar_insurance_cost = calculate_insurance_cost(age = 35,sex = 1,bmi = 22.2,num_of_children = 0,smoker = 1)

Can we use keyword arguments in Python? Don’t answer that, we can. However, do we need to use them in this instance given that the order is the same as the parameters? Why not just send the values?

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.