In Python, randint is a function from the random module that generates a random integer within a specified range. Here's a simple number guessing game in Python. The program will randomly choose a number between a specified range, and the player will try to guess it.
- The program selects a random number between 1 and 100.
- The user is prompted to guess the number.
- If the guess is too low or too high, the program gives feedback to the user.
- The game continues until the user guesses the correct number, and the program will display how many attempts it took to guess the number.
We can modify the
lower_boundandupper_boundvariables to adjust the difficulty of the game.