Eilenberg-Mac lane spaces and a generalization Let $G$ and $H$ be two abelian groups and let $n>1, m>1$ be two different integers. How many different spaces $X$ (up to homotopy) do we have with the property $\pi_{n} X=G$ , $\pi_{m} X=H$ and $\pi_{\ast} X=0$ otherwise? is this number finite ? 
 A: One way to think about how to distinguish, if not classify, such spaces is by homotopy operations. In the same way that cohomology operations are natural transformations between cohomology functors, homotopy operations are natural transformations between homotopy functors. By the Yoneda lemma, natural transformations $\pi_n \to \pi_m$ are in natural bijection with the homotopy group $\pi_m(S^n)$, so elements of the homotopy groups of spheres give unary operations on homotopy.
More generally, the $k$-ary operations on homotopy groups are natural transformations $\pi_{n_1} \times \dots \times \pi_{n_k} \to \pi_m$, and by the Yoneda lemma these are in natural bijection with the homotopy group $\pi_m(S^{n_1} \vee \dots \vee S^{n_k})$. For example, the Whitehead bracket $\pi_n \times \pi_m \to \pi_{n+m-1}$ is a well-known family of binary operations coming from some distinguished homotopy classes of maps $S^{n+m-1} \to S^n \vee S^m$. They make the homotopy groups of a space into a graded Lie algebra (up to a degree shift). All of the homotopy operations together give the homotopy groups of a space the structure of a $\Pi$-algebra, analogous to but much more complicated than the structure of being a module over the Steenrod algebra. 
A product of Eilenberg-MacLane spaces always has trivial homotopy operations, so you can distinguish a space from a product of Eilenberg-MacLane spaces by checking to see whether any of its homotopy operations are trivial. For example, the homotopy operation $\pi_2(S^2) \to \pi_3(S^2)$ given by a generator of $\pi_3(S^2) \cong \mathbb{Z}$ must be nontrivial since it is the universal example; this shows that the $3$-truncation of $S^2$ is a homotopy type with $\pi_2 \cong \pi_3 \cong \mathbb{Z}$ and all other homotopy groups trivial but which cannot be homotopy equivalent to $B^2 \mathbb{Z} \times B^3 \mathbb{Z}$. 
Moreover, it's a classical result that $H^4(B^2 A, B)$, the cohomology group that classifies the $k$-invariant of a space with $\pi_2 \cong A, \pi_3 \cong B$, can be identified with the group of quadratic functions $A \to B$. Given such a $k$-invariant, the corresponding quadratic function turns out to be precisely the homotopy operation $\pi_2 \to \pi_3$. So in this case the classification by $k$-invariants and by homotopy operations agree. 
A: Assuming $m > n$, there is a method for classifying such spaces using a technique from the Postnikov tower. Namely, such a space has a map $X \to K(G,n)$ inducing an isomorphism on $\pi_n$, and if we convert this into a fibration it has fiber $K(H,m)$.
Such bundles are classified by a "k-invariant": an element in $H^{m+1}(K(G,n) ; H)$. One direction takes such a cohomology class, represents it as a map $K(G,n) \to K(H,m+1)$, and then takes a (homotopy) pullback. To see that this is actually a bijective correspondence requires a little bit of obstruction theory (and uses critically that $n > 1$; otherwise we'd also need to classify an action of $G$ on $H$).
One should note that if you only ask that $\pi_n X$ and $\pi_m X$ are abstractly isomorphic to $G$ and $H$ rather than choosing isomorphisms, the $k$-invariant is only well-defined up to the action of the automorphism groups $Aut(G)$ and $Aut(H)$ on $H^{m+1}(K(G,n); H)$. 
If $G$ and $H$ are finitely generated abelian groups and at least one of them is finite, then Serre's work using mod-$\cal C$ theory shows that this cohomology group is finite; however, in general you can certainly have infinitely many distinct isomorphism classes (e.g. there are infinitely many homotopy types with $\pi_2 = \pi_3 = \Bbb Z$, because $H^4 K(\Bbb Z,2) \cong \Bbb Z$).
