Storing the index
indices [ ind ] = i NEW_LINE ind += 1 NEW_LINE if k < elements [ 0 ] : NEW_LINE print ( " Not ▁ found " ) NEW_LINE exit ( 0 ) NEW_LINE else : NEW_LINE for i in range ( 1 , ind + 1 ) : NEW_LINE INDENT if k <= elements [ i ] : NEW_LINE INDENT start = indices [ i - 1 ] NEW_LINE end = indices [ i ] NEW_LINE set_flag = 1 NEW_LINE break NEW_LINE DEDENT DEDENT if set_flag == 0 : NEW_LINE start = indices [ i - 1 ] NEW_LINE end = n NEW_LINE for i in range ( start , end + 1 ) : NEW_LINE if k == arr [ i ] : NEW_LINE INDENT j = 1 NEW_LINE break NEW_LINE DEDENT if j == 1 : NEW_LINE print ( " Found ▁ at ▁ index " , i ) NEW_LINE else : NEW_LINE print ( " Not ▁ found " ) NEW_LINE