Maps between Eilenberg–MacLane spaces I was re-reading an algebraic topology book the other day, and I came across the following problem:

Suppose that $\pi$ and $\rho$ are abelian groups and $n\geq 1$.  Determine $[K(\pi,n),K(\rho,n)]$, the set of (based) homotopy classes of maps between the corresponding Eilenberg-MacLane spaces.

I believe that the following is a solution:  We have two functors $K(-,n)$ from (discrete) abelian groups to (the homotopy category of nice) topological spaces, and $\pi_n = [S^n,-]$ going the other direction.  When we suitably restrict these functors, they appear to be inverses.  Therefore $[K(\pi,n),K(\rho,n)]\cong \hom_{Ab}(\pi,\rho)$
I have two questions.  Is the solution correct, or are there errors in the logic?  If it does work, is there a way to make it completely transparent that the functors are inverse to each other?  And if it is correct, if we suitably topologize $\pi_n(-)$, does this extend to non-discrete topological groups?
Second, is there a different way to approach the problem which better illuminates what is going on or illustrates an important point about $K(\pi,n)$?
 A: Here is a sketch of an alternate proof that does not invoke representability of $H^n$.
First, if $\langle g_1, \dots \mid r_1, \dots\rangle$ is a presentation for $G$, we can find a CW complex with $\pi_k(X) = 0$ for $k < n$ and $\pi_k(X) = G$, as follows. First, by looking at the relative homotopy groups, one sees rather easily that $\vee_S S^n$ has $\pi_n$ free abelian on $|S|$ generators. So wedge on a sphere for every generator of the group. Now add an $(n+1)$-cell whose attaching map is $r_1$; relative homotopy LES again (+ excision) shows that this kills the given relator and only the given relator. Now do this for every relation, and then glue on higher cells to kill off higher homotopy groups. This is a construction of $K(G,n)$.
Now for a homomorphism $\varphi: G \to H$, let's construct a continuous map $f_\varphi: K(G,n) \to K(H,n)$ inducing that map on homotopy groups. The construction here is rather obvious: send the $n$-cells to wherever the generators go under $\varphi$; the assumption that $\varphi$ is a homomorphism means that you can extend this map continuously over the $(n+1)$-cells; and the fact that $\pi_k(K(H,n)) = 0$ for $k>n$ means you can extend it continuously over the $(k+1)$-cells.
Now given two maps that both induce $\varphi$, I want to find a map $K(G,n) \times I \to K(H,n)$ that extends them. Putting the obvious cell structure on $K(G,n) \times I$, first extend across the new $(n+1)$-cells by finding a homotopy between the maps from the $S^n$s (which is true by the assumption that they both induce the same map on $\pi_n$); now for the higher cells, the story is the same as before: because $\pi_k(K(H,n)) = 0$ for $k>n$, we can automatically extend them.
Note that I needed an explicit model for $K(G,n)$ here, but not for $K(H,n)$. By Whitehead this implies that if $K'$ is another CW complex model for $K(G,n)$, the two spaces are homotopy equivalent (and otherwise are weakly so); hence the same answer applies no matter what model I pick for $K(G,n)$.
A: Recall that $[X,K(G,n)]=H^n(X;G)$. Hence $[K(\pi,n),K(\rho,n)]=H^n(K(\pi,n);\rho)$ — which (by Hurewicz theorem + universal coefficients) is exactly $\hom(\pi,\rho)$.
