-
-
Save codecademydev/d3f9762eac0c13e358b1979903e1122a to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create calculate_insurance_cost() function below: | |
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 | |
#q13 - extras | |
def calculate_insurance_difference (maria_insurance_cost, omar_insurance_cost): | |
return maria_insurance_cost - omar_insurance_cost | |
print(calculate_insurance_difference) | |
# Estimate Maria's insurance cost | |
maria_insurance_cost = calculate_insurance_cost(name= "Maria", age= 28, sex=0, bmi = 26.2, num_of_children = 0, smoker = 0) | |
# Estimate Omar's insurance cost | |
omar_insurance_cost = calculate_insurance_cost(name= "Omar", age = 35, sex = 1, bmi = 22.2, num_of_children = 0, smoker = 1) | |
# now we try to calculate my own insurance costs | |
darrin_insurance_cost = calculate_insurance_cost(name= "DM", age=26, sex=0, bmi=24.8, num_of_children= 0, smoker=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment