Momentum logo
Team 8 Classroom

Working with modules

Step 1

Write a simple number guessing game. Your game should import the random module to generate a random integer between 1 and 20. When the program runs, it should prompt the user for a guess and then tell them if their guess was too high, too low, or correct.

Step 2

Modify your game so that it tells the user how many tries it took them to guess the right number.

Step 3

Limit the number of tries a user has to guess the number correctly. If the user doesn’t guess it in the number of tries you’ve limited them to, they lose.