I keep getting the error "<main.reverse object at 0x000001C1E1EAE9E8>"
class reverse:
def __init__(self, list1):
self.list1 = list(reversed(list1))
i = reverse([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(i)
class reverse:
def __init__(self, list1):
self.list1 = list(reversed(list1))
i = reverse([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print(i)
This is not "an error". This is just the default representation of objects that do not implement __str__
.
You may want to implement it, ie
class reverse:
def __init__(self, list1):
self.list1 = list(reversed(list1))
def __str__(self):
return str(self.list1)
See related question.