1

I have a class:

class point:

    def __init__(self,x,y):
        self.x = x
        self.y = y

    def __str__(self):
        return "({},{})".format(self.x,self.y)

This works for printing out individual points, but if I have a list of points, the print function isnt overridden. How do I fix this so that the string function prints out what I want even when I have a data structure containing points?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135

0 Answers0