
Douglas B. answered 05/30/20
Tutor
4.9
(83)
Precalculus tutor with masters degree in applied math
It is actually possible. A canonical example of this is the Dirchlet function:
For 0 <= x <= 1, define:
f(x) = 0 if x irrational
f(x) = 1 if x is rational.