Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created December 11, 2020 12:37
Show Gist options
  • Save codecademydev/82590dc77113a59a2860680779f83fee to your computer and use it in GitHub Desktop.
Save codecademydev/82590dc77113a59a2860680779f83fee to your computer and use it in GitHub Desktop.
Codecademy export
# Create calculate_insurance_cost() function below:
def calculate_insurance_cost(age, sex, bmi, num_of_children, smoker, name):
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
def calculate_insurance_difference(individual1, individual2):
cost_difference = individual1 - individual2
individual1 = maria_insurance_cost
individual2 = omar_insurance_cost
print("The difference in insurance cost is ")
# Estimate Maria's insurance cost
maria_insurance_cost = calculate_insurance_cost(age = 28, sex = 0, bmi = 26.2, num_of_children = 3, smoker = 0, name = 'Maria')
# Estimate Omar's insurance cost
omar_insurance_cost = calculate_insurance_cost(age = 35, sex = 1, bmi = 22.2, num_of_children = 0, smoker = 1, name = 'Omar')
tom_insurance_cost = calculate_insurance_cost(age = 23, sex = 1, bmi = 22.4, num_of_children = 0, smoker = 1, name = 'Tom')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment