Feb-24-2019, 03:12 AM
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def height(self): left_height = 0 right_height = 0 if self.left: left_height = self.left.height() if self.right: right_height = self.right.height() return max(left_height, right_height) + 1How can I clean up my height function? I think it's a bit verbose. I feel like there should be a simpler way to do this?