class Mylist(object): 
    def __init__(self):
        self.vals = []
        
    def insert(self, x):
        self.vals.append(x)
        
list1 = Mylist()
list1.insert(9)
list1.insert(8)
list1.insert(9)
print(list1)
            Asked
            
        
        
            Active
            
        
            Viewed 17 times
        
    0
            
            
        - 
                    You need to implement the function `__str__` – Nabil Jan 16 '22 at 14:33
- 
                    You can try something like this `def __str__(self): return ','.join(str(x) for x in self.vals)` – Nabil Jan 16 '22 at 14:44
 
    