DataScience | Classes | Medical Insurance Project

DataScience Classes | Medical Insurance Project

I get invalid syntax error for line 14 and 37 but cannot find any indent or character errors.

Any ideas.


There are a few things.

Look at how estimated_cost= is defined. You left out key pieces of information in the formula. Remember, you’re using class variables here so you have to use the self keyword.

estimated_cost = 250 * self.age - 128 * …etc

Also, revisit how you utilized the .format() function.
Your code: print("{0}'s estimated insurance costs are {1}".format(, str(estimated_cost))


You don’t really need to use “{0}” and “{1}” b/c Python replaces the placeholders by value in order that they’re listed. You also don’t need to convert the second items to str().


As already mentioned, make sure you include the self keyword for all the attributes.

There actually isn’t a problem with your formatted strings, though. You’re just missing a whole bunch of closing parentheses.

Thank guys. All fixed

1 Like