Find K such that | A | Function to find k such that | a - k | = | b - k | ; If ( a + b ) is even ; Driver code
def find_k ( a , b ) : NEW_LINE INDENT if ( ( a + b ) % 2 == 0 ) : NEW_LINE INDENT return ( ( a + b ) // 2 ) ; NEW_LINE DEDENT return - 1 ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT a = 2 ; b = 16 ; NEW_LINE print ( find_k ( a , b ) ) ; NEW_LINE DEDENT