Your progress is not saved. Create a free account to keep it.
Generating a Random Integer
Use the random module for your guessing game
To generate a random integer for a number guessing game, you can use the randint function inside Python's random module.
First, import the module, and then call random.randint() with a range:
import random
number = random.randint(10, 30)In this example, number will contain a random integer from 10 up to and including 30. Notice that the maximum number in random.randint is inclusive.