What is a yellow or red card in soccer?

In the game of soccer, whenever a player commits a foul, the referee can give a player a yellow card or a red card. A yellow card is a caution/warning. A red card is a dismissal and the player has to leave the field.