Python Syntax: Medical Insurance Project
age = 28 | |
#sex is 0 for female and 1 for male | |
sex = 0 | |
bmi = 26.2 | |
num_of_children = 3 | |
#smoker is 0 for non and 1 for smoker | |
smoker = 0 | |
insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker -12500 | |
print("This person's insurance cost is " + str(insurance_cost) + " dollars.") | |
#age factor: | |
new_age = age + 4 | |
new_age_cost = 250 * new_age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker -12500 | |
change_age_cost = new_age_cost - insurance_cost | |
print("The change in cost of insurance after increasing the age by 4 years is " + str(change_age_cost) + " dollars.") | |
#bmi factor: | |
new_bmi = bmi + 3.1 | |
new_bmi_cost = 250 * age - 128 * sex + 370 * new_bmi + 425 * num_of_children + 24000 * smoker -12500 | |
change_bmi_cost = new_bmi_cost - insurance_cost | |
print("The change in cost of insurance after increasing the bmi by 3.1 is " + str(change_bmi_cost) + " dollars.") | |
#sex factor: | |
new_sex = sex + 1 | |
new_sex_cost = 250 * age - 128 * new_sex + 370 * bmi + 425 * num_of_children + 24000 * smoker -12500 | |
change_sex_cost = insurance_cost - new_sex_cost | |
print("The change in estimated cost for being male instead of female is " + str(change_sex_cost) + " dollars.") | |
#smoking factor: | |
new_smoker = smoker + 1 | |
new_smoker_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * new_smoker -12500 | |
change_smoker_cost = new_smoker_cost - insurance_cost | |
print("The change in estimated cost for being a smoker is " + str(change_smoker_cost) + " dollars.") | |
#children factor: | |
no_children = num_of_children - 3 | |
no_children_cost = 250 * age - 128 * sex + 370 * bmi + 425 * no_children + 24000 * smoker -12500 | |
change_children_cost = insurance_cost - no_children_cost | |
print("The change in estimaged cost for having no children is " + str(change_children_cost) + " dollars.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment