Page 140 - KEC Khaitan C8 Flipbook
P. 140
PROJECT NAME: Guess The Number (Continuous Attempt)
Software Used: Python Editor
Objective:
Develop a Python program to simulate a guessing game where the computer randomly selects
a number within a fixed range. The user repeatedly guesses until they correctly identify the
computer's choice.
Platform:
∑ PyCharm
∑ Google Colab: https://colab.research.google.com/
Step-by-Step Instructions
Plan IPO Framework
Step 1 Input:
Define a fixed range for the game (e.g., 1 to 100).
The computer randomly selects a number using Python’s random library.
The user enters their guesses.
Step 2 Process:
Continuously compare the user’s guess with the computer's number until it matches:
o If the guess is too low, display: "Too low, try again."
o If the guess is too high, display: "Too high, try again."
o If the guess is out of range, display: "Invalid guess. Please enter a number within
the range."
o If the guess is correct, display: "Congratulations! You've guessed it right."
Repeat the process until the correct number is guessed.
Step 3 Output:
Provide feedback on whether the guess was too low, too high, invalid, or correct.
Code:
138 Premium Edition-VIII

