deleteleaves ( )
def deleteLeaves ( root , x ) : NEW_LINE INDENT if ( root == None ) : NEW_LINE INDENT return None NEW_LINE DEDENT root . left = deleteLeaves ( root . left , x ) NEW_LINE root . right = deleteLeaves ( root . right , x ) NEW_LINE if ( root . data == x and root . left == None and root . right == None ) : NEW_LINE INDENT return None NEW_LINE DEDENT return root NEW_LINE DEDENT