-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_flow.py
36 lines (30 loc) · 1.44 KB
/
control_flow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Add your code here
def analyze_smoker(smoker_status):
if smoker_status == 1:
print("To lower your cost, you should consider quitting smoking.")
else:
print("Smoking is not an issue for you.")
def analyze_bmi(bmi_value):
if bmi_value > 30:
print("Your BMI is in the obese range. To lower your cost, you should significantly lower your BMI.")
elif bmi_value >= 25 and bmi_value <= 30:
print("Your BMI is in the overweight range. To lower your cost, you should lower your BMI.")
elif bmi_value >= 18.5 and bmi_value <= 25:
print("Your BMI is in a healthy range.")
else:
print("Your BMI is in the underweight range. Increasing your BMI will not help lower your cost, but it will improve your health.")
# Function to estimate insurance cost:
def estimate_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(name + "'s Estimated Insurance Cost: " +
str(estimated_cost) + " dollars.")
analyze_smoker(smoker)
analyze_bmi(bmi)
return estimated_cost
# Estimate Keanu's insurance cost
keanu_insurance_cost = estimate_insurance_cost(
name='Keanu', age=29, sex=1, bmi=26.2, num_of_children=3, smoker=1)
# Estimate Scott's insurance cost
scott_insurance_cost = estimate_insurance_cost(
name='Scott', age=49, sex=1, bmi=35.9, num_of_children=1, smoker=0)