.
They say: a code is four-digit number, and every of its four digits is either 0, or 1 or 2.
Repeating is allowed, since the opposite is not stated.
Thus the set of codes is the set of ALL four-digit numbers, where each digit is either 0, or 1, or 2 independently each of the other.
Hence, there are 3 opportunity for each of four digits (places) - it gives you
= 3*3*3*3 = 81 possible codes, in all.
The most important lesson to learn from this solution is that
the set of all possible codes is the set of all 4-digit numbers with the digits 0, 1 and 2.
That is all.