class BiTNode: def __init__(self, data, left, right): self.data = data self.left = left self.right = right t = BiTNode(10, BiTNode(2,None,None), BiTNode(3,None,None)) def sum_tree(t:BiTNode): total=0 if t != None: total += t.data total += sum_tree(t.left) total += sum_tree(t.right) return total sum_tree(t)
15