This is a homework question and I would appreciate if someone could check my reasoning. This seems too simple to be true.
Proof: Assume there exists $X$ with a non-constant function $f:S^n\rightarrow X$ such that $f\not\simeq c_x$. This implies that $1 = |\pi_0(S^n)|\neq|\pi_0(X)| \implies |\pi_0(X)| \geq 2 \implies X$ is non-contractible.