-
-
Save codecademydev/bcd1c5df5c5bc3fcdcdcdbe9098a8375 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
class Patient: | |
def __init__(self, name, age, sex, bmi, num_of_children, smoker): | |
self.name = name | |
self.age = age | |
# add more parameters here | |
self.sex = sex | |
self.bmi = bmi | |
self.num_of_children = num_of_children | |
self.smoker = smoker | |
def estimated_insurance_cost(self): | |
estimated_cost = 250*self.age - 128*self.sex + 370*self.bmi + 425*self.num_of_children + 24000*self.smoker - 12500 | |
print("{}’s estimated insurance costs is {} dollars.".format(self.name, estimated_cost)) | |
patient1 = Patient("John Doe", 25, 1, 22.2, 0, 0) | |
print(patient1.estimated_insurance_cost()) |
I think you should call the estimated_insurance_cost method with a print function because when you return the total estimated cost, you use print.
use the instance of the class variable for Patient
patient1.estimated_insurance_cost()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run