DEMO 1: We can create probability using random.randint(). In the game, we want coins to be created half of the time and we want one of the two types of obstacles to be created the other half of the time.

  • Click 'New Random Number' at least three times to generate new random numbers between 1 and 100.

The more times you click, the clearer the difference between blue_count and the other two variables will become.

  • Click Ticket and answer the questions.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)