I am trying to iterate over each number (and print it) that is associated with an object when it is initialized but only first element is returned and not the others. But this should work for normal for loop right?
class Test():
def __init__(self):
self.data = [1,2,3,4,5,6,7,8]
def listelements(self):
for i in self.data:
return [i]
a = Test()
print(a.listelements())