Learn Special Methods by Building a Vector Space - Step 10

Tell us what’s happening:

I’m taking self.x and self.y, putting that into a tuple, then turning that into a string. It’s outputting (‘2’, ‘3’).

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
        
    def __str__(self):
        return str(tuple(f'{self.x}{self.y}'))

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

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36

Challenge Information:

Learn Special Methods by Building a Vector Space - Step 10

check what is printed, it should be (2, 3). Your code doesn’t produce that, it produces ('2', '3'), those quotes should not be there

note, you don’t need to use the tuple function, tuples are mentioned because that’s what the string should look like: (2, 3) in fact looks like a tuple that contains 2 and 3. To make a string look like a tuple you don’t need tuple, that you would need if you wanted an actual tuple.