Here's a quick recap of how this example game is going to work. The Raspberry Pi will choose a random button and ask the player to press it. Every time the player presses the correct button, they get a point, and every time they press a wrong button, they lose a point. Once the correct button has been pressed, the Raspberry Pi selects a new button as the target. The aim is to score as many points as possible in 30 seconds.
In Python 2, navigate to File | New Window. This will bring up a new empty Code Editor window, which is where all our code will go.
The first job, then, is to write some code that will choose a random button for the player to press. Take a look at the following code snippet:
import random options ...