Solution did not use .get_rate()

https://www.codecademy.com/paths/computer-science/tracks/cspath-python-objects/modules/cspath-python-classes/lessons/inheritance-and-polymorphism/exercises/interfaces

When trying to program step 3, I programmed the solution using .get_rate, but wouldn’t accept the answer. When I looked at the solution the solution did not use .get_rate(). was the mistake the “.” that was placed before “get_rate()”?

Give HomeInsurance a .get_rate() method

Your method should not have a dot in the name…

def get_rate(self):
1 Like

My point exactly, but the instructions said to do it. It is very frustrating for a novice to understand what is being taught without the instructions being wrong.

1 Like

For future reference, methods are attributes, and like all attributes, are called on the instance.

my_car = VehicleInsurance()
my_car.get_rate()

That’s why we often see methods written in narratives with a leading dot. The dot tells us it is a method, and not a function. Perhaps that needs to be better explained early on in lessons about classes. At least now you know.

1 Like

Thank you for explaining that. Now I have a better understanding. There is a lot to learn.

2 Likes