I have coded a binary tree structure in python. I could enter the data for each nodes but could not iterate it once insertion process is over (like in Java 12) and print it in the tree format.
class Tree:
    def __init__(self, data):
        self.data = data
        self.left = None
        self.right = None
def Insert(i, p):
    if i == 4:
        return
    else:
        p.left = Tree(input("Enter Value for left node\n"))
        p.right = Tree(input("Enter Value for right node\n"))
        Insert(i+1, p.left, )
        Insert(i+1, p.right, )
root = Tree(1)
Insert(0, root)
print(root)
When I print the root, I get its location in memory (something like:
 <__main__.Tree object at 0x036D45D0>).
Is it possible to print all the values of the each node?
 
     
    