An arbitrary product of connected spaces is connected

Solution 1:

Remember that you don't need to show $f^{-1}(U)$ is open in $X$, only that it is open in the subspace $X_K$ of $X$. I would also remark that the uncountable case should be no harder than the countable case; it's just a matter of notation. If $J$ is uncountable, you can still label the elements of $K$ with natural numbers $\{1,2,\dots,n\}$; the only difference is that the remaining elements of $K$ will not be other natural numbers (and you don't really care what they are).

Solution 2:

As you said, only Hints:

1) countable or not? Doesn't care. The only thing that matters is that $K$ is finite

2) $f$ is not continue if you go from $X$ to $Z$, but your $f$ is from $X_K$ to $Z$, and $X_K$ has a different topology..