Tell us what’s happening:
Hi, this is a bit annoying. In the previous step (6) my return statement for the norm method was: return math.sqrt(self.x2 + self.y2) and it kept telling me this was wrong but offered no other explanation.
Eventually I changed it to: return (self.x2 + self.y2)**0.5 which is exactly the same!!! I would have thought using the math.sqrt function was a better and more transparent coding option
Your code so far
# User 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
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Challenge Information:
Learn Special Methods by Building a Vector Space - Step 7