Python Classes: Medical Insurance Project

Hi everyone,
did someone manage the try and except statements to ensure that patient data is uploaded using numerical values?
Could you please help me?
Thanks in advanced and have a great day!

Dear All,

I’m struggling with question 6 on the “Python Classes: Medical Insurance Project”. I’m getting a “AttributeError” even though I changed my answer to what the “Hints” section showed should be the correct answer.

For this questions I had to generate a update_age() method and then test out the method with the patient1 instance variable.

The hint section suggests patient1.update_age(26).

Did I miss something? Your help would be greatly appreciated.

see below:

An attribute error suggests you’ve tried to access an attribute that isn’t bound to a class. Have you made sure that your attributes are all correctly defined as part of that class?

Hint

Have a close look at the indentation. Functions that are designed to be methods of that class should be part of the body of that class.

You have indeed several problems with indentations.
I would recommend to start for the top to the bottom line of your code.

And then, to fix your attribute error, I would suggest you to take a look on the review’s part (nb.14) of the Classes chapter.
You will find the correct way to call the estimated_cost function.

Thank you so much! Mainly the indentations and a small issue with the update_age formula needed rectifying. It works great now.

Thank you so much! It works great now.