Back to Freecodecamp

Step 7

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

latest637 B
Original Source

--description--

Outside the Vector class, create an instance of Vector passing the integers 2 and 3 as the x and y values and assign it to a variable named v1.

--hints--

You should declare a variable v1 and assign it Vector(2, 3).

js
({
    test: () => assert(runPython(`
      _Node(_code).find_variable("v1").is_equivalent("v1 = Vector(2, 3)")
    `))
})

--seed--

--seed-contents--

py
--fcc-editable-region--
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
--fcc-editable-region--