Roject Python Classes: Medical Insurance Project

Does anyone have the solutions for the medical insurance project? I got stuck on problem #4 with an error. Here’s the script and the error:

print(name + “'s estimated insurance cost is " + str(estimated_cost) + " dollars.”)


File “”, line 2
def init(self, name, age, sex, bmi, num_of_children, smoker):
IndentationError: expected an indented block

Please don’t directly ask for solutions, the forums are slanted towards helping users solve their own problem instead of just teaching copy/paste skills :wink:. Since you have mentioned the error I’ll cover that. The following has some useful info- How to ask good questions (and get good answers). If nothing else the section on formatting code is exceedingly helpful for anyone who tries to help as Python without indents is baffling :slightly_smiling_face:. Please oh please format indented Python code.

That particular error mentions indents directly. I’m assuming that’s the __init__ function being bound to class? It must be part of the class definition which means it must be indented, e.g.

class Name:
    def __init__(self, vars):

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.