Each digit of the squawk code can be set to a number from 0 to 7. This is because the code is transmitted in an octal (base-8) number system, not decimal (base-10). Squawk codes range from 0000 to 7777. The maximum digit is 7; you will never be instructed to squawk an 8 or 9 (if you hear one, it is likely an error).
When you are assigned a squawk code, you enter it into the transponder using the rotating dials on the face of the unit. Modern transponders may have digital displays and button-entry systems, but the principle is the same. Once set, leave the transponder on and the code active. The facility will then be able to identify your radar target uniquely.
In certain situations, you are assigned a standard squawk code rather than a discrete code assigned individually to you:
7000:VFR squawk. Used in VFR flight within European airspace when you are not assigned a discrete squawk. Set your transponder to 7000 and leave it there throughout your flight unless instructed otherwise.
7500: Hijacking or unlawful interference. Squawk 7500 only if your aircraft is being hijacked or subjected to unlawful interference. This is a distress code that triggers immediate response from ATC
7600: Radio failure. Squawk 7600 if your radio has failed and you are unable to communicate with ATC. See Lection 13 for detail.
7700: Emergency. Squawk 7700 if you are in distress or grave danger. This is the highest-priority emergency code. See Lection 13 for detail.