Artificial intelligent assistant

Characterize continuous functions $f : X → Y$ for which $f^{− 1} ( \{ a\} )$ is open Let X and Y be topological spaces and f : X → Y be a continuous function. Prove that for every a ∈ Y the set $f^{−1}$({a}) is a closed set. Assume that X is connected. Characterize all continuous functions f : X → Y for which $f^{−1}$ ( { a } ) is open as well. I used the answer of Can continuity be proven in terms of closed sets? to proof the first part (for sets instead of a single element of Y). But I cannot characterize all continuous functions.

If $Y$ is $T_1$, then all sets $\\{a\\}$ for $a \in Y$ are closed subsets, so $f^{-1}[\\{a\\}]$ is closed as the inverse image of a closed set under a continuous function.

If there is some $a_0 \in Y$ such that $f^{-1}[\\{a_0\\}]$ is non-empty and open, and if $X$ is connected, then $f^{-1}[\\{a_0\\}]$ is closed, open and non-empty, and in a connected space this means that $f^{-1}[\\{a_0\\}] = X$ (otherwise the set and its complement disconnect $X$!). And this in turn is equivalent to $f$ being constant (with value $a_0$). Note that then all $f^{-1}[\\{a\\}]$ are open, as for $a \
eq a_0$ the set is just the (open) empty set. (And if all inverse images of singletons are open, one of them at least is non-empty, and the previous applies).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy fc3ea2a2db86d439009f2096a9e31872