input some code and click trace
class Node(object): def __init__(self, value): self.value = value self.left = None self.right = None def __repr__(self): return f'Node({self.value})' class BinaryTree(object): def __init__(self, root): self.root = Node(root) def print_tree(self, traversal_type): if traversal_type == "preorder": return self.pre_order_print(self.root, "") else: print("Traversal type" + str(traversal_type)+ " is not supported") def pre_order_print(self, start, traversal): if start: traversal += (str(start.value) + "-") traversal = self.pre_order_print(start.left, traversal) traversal = self.pre_order_print(start.right, traversal) return traversal tree = BinaryTree(21) tree.root.left = Node(8) tree.root.left.left = Node(2) tree.root.left.right = Node(19) tree.root.right = Node(50) tree.root.right.left = Node(36) tree.root.right.right = Node(69) print(tree.print_tree("preorder"))
or paste some code to permalink to the trace
https://cpy.pt/
github.com/raylu/traceface