The original answer here is a bit thin on detail. In The Sims 3, you typically open the cheat console by pressing Ctrl + Shift + C on your keyboard (this works on laptops too). A text bar will appear at the top, where you can type your cheat codes and hit Enter. If that shortcut doesn't work, checking your game's control settings is a good next step.