Find a function f:R->R (R the set of real numbers), such that

1. f has a discontinuity in every rational number, but is continous everywhere else, and

2. f is monotonic: x<y → f(x)<f(y)

Note: Textbooks frequently present examples of functions that meet only the first condition; requiring monotonicity makes for a slightly more challenging problem.

(In reply to

Needless to say this is very confusing by Charlie)

Charlie,

it doesn't matter that there are infinitely many discontinuities in a
given epsilon-neighborhood of the irrational (which there are), so long
as all of function values in the neighborhood can be made arbitrarily
close to the function value of the irrational by picking an
appropriately small epsilon.

That is the situation with the weird function that has been
identified. As we approach the irrational from the left and from
the right, the limit of the function values equal the function when
evaluated at the irrational.