Learn Special Methods by Building a Vector Space - Step 8

Hi.

I’m on this step which asks to test ‘norm’ by passing v1 in a print call statement… well, I think I did the correct thing and even got the correct numeric output (3.605551275463989) on the console, and yet the tutorial won’t let me through… what am I doing wrong?

class Vector:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        
    def norm(self):
        return (self.x**2 + self.y**2)**0.5

v1 = Vector(2, 3)
print(Vector.norm(v1))

Thank you.

Michal.

you need to call the method on v1, not use the class
v1.methodName()

HI ILM,

Thank you for that hint. I see that there are two ways to skin a cat. And this is the proper technique.

removed

Please dont post solutions, thanks!

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like