Back to Freecodecamp

Step 5

curriculum/challenges/english/blocks/learn-special-methods-by-building-a-vector-space/65f058e06f34fd1f0ee6e55d.md

latest663 B
Original Source

--description--

Next, within the Vector class, create an empty norm method and give it a self parameter.

--hints--

Your Vector class should have a norm method.

js
({
    test: () => assert(runPython(`
      _Node(_code).find_class("Vector").has_function("norm")
    `))
})

Your norm method should have a self parameter.

js
({
    test: () => assert(runPython(`
      _Node(_code).find_class("Vector").find_function("norm").has_args("self")
    `))
})

--seed--

--seed-contents--

py
--fcc-editable-region--
class Vector:
    def __init__(self, x, y):
        self.x = x
        self.y = y
--fcc-editable-region--