Let $\pi:X\rightarrow Y$ be a quotient map and Z be a topological space. Show that $g:Y\rightarrow Z$ is continuous iff $g\circ \pi:X\rightarrow Z$ is continuous.
My attempt:
$\Rightarrow:$ We know that $(X,\mathcal{T}_X),(Y,\mathcal{T}_Y),(Z,\mathcal{T}_Z)$ are topological spaces. Suppose that $g:Y\rightarrow Z$ is continuous. We must prove that $g\circ \pi:X\rightarrow Z$ is continuous; for it, we take an open set $A\subset Z$, ie $A\in \mathcal{T}_Z$ and we will show that $(g\circ \pi)^{-1}(A)\in\mathcal{T}_X$.
Note first that $(g\circ \pi)^{-1}(A)=(\pi^{-1}\circ g^{-1})(A)=\pi^{-1}(g^{-1}(A))$.
Since $g:Y\rightarrow Z$ is continuous and $A\in \mathcal{T}_Z$, then $g^{-1}(A)\in \mathcal{T}_Y$. Moreover, since $\pi:X\rightarrow Y$ is a quotient map and also $g^{-1}(A)\in \mathcal{T}_Y$, we have that $\pi^{-1}(g^{-1}(A))\in \mathcal{T}_X \Leftrightarrow (g\circ \pi)^{-1}(A) \in \mathcal{T}_X$, As we wanted to try. Therefore, $g\circ \pi:X\rightarrow Z$ is continuous.
$\Leftarrow:$ Suppose that $g\circ \pi:X\rightarrow Z$ is continuous. We must prove that $g:Y\rightarrow Z$ is continuous; for it, we take an open set $B\subset Z$, ie $B\in \mathcal{T}_Z$ and we will show that $g^{-1}(B)\in \mathcal{T}_Y$.
...
Someone could help me finish this proof, please. Best regards.
Remember that if $\pi : X \to Y$ is a quotient map then it is surjective, and $U \subset Y$ is open if and only if $\pi^{-1}(U) \subset X$ is.
With this in mind, let's take an open set $B$ of $Z$. Consider $g^{-1}(B)$. Because $g \circ \pi$ is continuous, $\pi^{-1}(g^{-1}(B))$ is open. So by the above, $g^{-1}(B)$ is open. Therefore $g$ is continuous.