Can somebody tell what a steam code is?

i want to know what a steam code is and if you need it to play a game?
portal 2 has a steam code and i am buying it second hand but i don't know if i should buy one with a steam code or not
4 answers 4