Function to get the count of leaf nodes in binary tree
def getLeafCount ( node ) : NEW_LINE INDENT if node is None : NEW_LINE INDENT return 0 NEW_LINE DEDENT if ( node . left is None and node . right is None ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT else : NEW_LINE INDENT return getLeafCount ( node . left ) + getLeafCount ( node . right ) NEW_LINE DEDENT DEDENT