Define a bijection between (0,1) and [0,1].

I know that in order to prove this is to use a piecewise function. So this is what I have.

(This is a piecewise function just could not figure out how to put it on here)

This is what I did... Please help me if im wrong.

f(x) = x if $\displaystyle x \neq \frac {1}{2^n} $ for any $\displaystyle n \epsilon N $f(x) =$\displaystyle \frac{1}{2^n} $ if $\displaystyle n \epsilon N\cup {0} $