if currentNode is a leaf , add its data to the sum
sum = sum + currentNode . left . data NEW_LINE if currentNode . right is not None : NEW_LINE stack . append ( currentNode . right ) NEW_LINE return sum NEW_LINE