Suppose $f:\mathbb{R}\rightarrow B$ is surjective, where $B$ is finite. Prove there is a $g:B\rightarrow\mathbb{R}$ s.t. $f(g(b))=b$ for each $b\in B$.
I'm given a hint to use induction on the cardinality of $B$. I'm not exactly sure how to go about the inductive step. The texts give the inductive hypothesis to be: for any onto function $f:C\rightarrow D$, where $|D|=n$ and $C\subset\mathbb{R}$, there is a suitable $g:D\rightarrow C$. However, I don't see why they suppose $C\subset\mathbb{R}$, and not just take $C$ to be $\mathbb{R}$.
Your texts seem really weird. All those requirements are not necessary.
Proof: For each $b \in B$, choose $g(b)$ to be a preimage of $b$ under $f$, i.e. choose $g(b) \in \{x : f(x) = b\}$, where $\{x : f(x) = b\}$ is always nonempty by surjectivity of $f$. Now $g$ satisfies the requirements.
By the way, if we use the axiom of choice, we can do this construction for any sets $B$, not just countable ones.