-
-
Save codecademydev/e1070c051d3337b25cf1ea934b651617 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 the initial variables below | |
age = 28 | |
sex = 0 | |
bmi = 26.2 | |
num_of_children = 3 | |
smoker = 0 | |
# Add insurance estimate formula below | |
insurance_cost = 250*age - 128 * sex + 370 * bmi | |
+ 425*num_of_children+2400*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+2400*smoker -12500 | |
change_in_insurance_cost = new_insurance_cost | |
- insurance_cost | |
print("The change in cost of insurance after increasing the age by 4 years is " + str(change_in_insurance_cost) + " dollars.") | |
# BMI Factor | |
bmi += 3.1 | |
new_insurance_cost = 50*age - 128 * sex + 370 * bmi | |
+ 425*num_of_children+2400*smoker -12500 | |
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 = 26.2 | |
sex = 1 | |
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 estimated cost for being male instead of female is ' + str(change_in_insurance_cost) + ' dollars') | |
# Extra Practice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment