lyst = file()
class Node:
def __init__(self,first,next=()):
self.first = first
self.next = next
def recursivelist(lyst):
assert len(lyst) > 0
if len(lyst) == 1:
return Node(lyst[0])
else:
return Node(lyst[0],recursivelist(lyst[1:]))
print(recursivelist(lyst))
This will return just this: <main.Node object at 0x7f976fd24130>
When I am wanting to actually see it. Is there any way I can actually do that? I saw online that I can use the str method in the class, but I have no idea how to implement that.
Any help would be extremely helpful. Thank you so much.