際際滷

際際滷Share a Scribd company logo
West Visayas State University
Calinog Campus
SCHOOL OF INFORMATION AND COMMUNICATIONS TECHNOLOGY
Number Guessing game
In partial fulfillment CC203  PORGRAMMING II as a
requirements for Bachelor of Science in Information Technology
by
Deon Raphael G. Palma
JC France Catalogo
Dennis Libuna
SY 2024-2025
2nd Semester
Number Guessing game
I. BRIEF INTRODUCTION
The number guessing game is a classic introduction to programming concepts like loops, conditional
statements, and user input. It's a fun and engaging way to learn the fundamentals of coding. In this game, the
computer generates a random number within a specific range. The player then tries to guess the number by
entering their own guesses. The program provides feedback to the player indicating if their guess is too high,
too low, or correct. The game continues until the player guesses the correct number.
II. PURPOSE AND DESCRIPTION
 Goal: The player tries to guess a hidden number chosen by the computer.
 Mechanics: The computer generates a random number within a specific range. The player keeps guessing
numbers until they guess the correct number.
 Feedback: After each guess, the game provides feedback indicating if the guess is too high or too low.
 Looping: The program continues to prompt the user for guesses until they guess the correct number.
 Entertainment: The guessing game is a fun and engaging way to pass the time.
III. FUNCTIONAL FEATURES
 Random Number Generation: The program uses the random module to generate a secret number.
 User Input: The program prompts the user to enter their guess.
 Guess Evaluation: It compares the user's guess with the hidden number.
 Feedback Loop: The program provides feedback ("Too high" or "Too low") based on the guess.
 Win/Lose conditions: The program can determine if the user has guessed the correct number and provide
congratulatory or informative messages accordingly.
 Play again functionality: The program allows the user to choose whether they want to restart the game
after each round.
IV. SYSTEM FLOWCHART
V. SOURCE CODE
import random # Import the random library to generate random numbers
while True: # Loop to keep playing until user decides to quit
# Game logic here
num = random.randint(1, 10) # Generate a random number between 1 and 10
guess = 0 # Initialize guess variable to 0
while guess != num: # Loop until the user guesses the correct number
guess = input("Guess a number between 1 and 10: ") # Ask for user's guess
guess = int(guess) # Convert the guess input (string) to an integer
if guess < num: # Check if guess is too low
print("Too low, try again.")
elif guess > num: # Check if guess is too high
print("Too high, try again.")
print("Congratulations! You guessed the number correctly!") # Congratulate player
def play_again():
"""Asks the user if they want to play again."""
while True:
choice = input("Do you want to play again? (y/n): ").lower()
if choice in ("y", "n"): # Check for valid input (y or n)
return choice == "y" # Return True if user wants to play again
else:
print("Invalid input. Please enter 'y' or 'n'.")
# Play again prompt
if not play_again(): # Check if user doesn't want to play again
break # Exit the loop and end the game
print("Thanks for playing!") # Thank the player for playing
VI. SCREENSHOTS
VI. SCREENSHOTS
VI. SCREENSHOTS
THANKS
Ad

Recommended

Number Guessing Game
Number Guessing Game
Manish Kumar
guess the number project.docx
guess the number project.docx
UtkarshSingh411848
Guess a number game v1.00
Guess a number game v1.00
Willie Barnes
Guess a number game v1.10
Guess a number game v1.10
Willie Barnes
Guees a number game v1.05
Guees a number game v1.05
Willie Barnes
Practice
Practice
Daman Toor
Thinking Like a Programmer
Thinking Like a Programmer
Cate Huston
PROJECT(voting system, rock paper scissor, emoji creation , tick tack toe in ...
PROJECT(voting system, rock paper scissor, emoji creation , tick tack toe in ...
TayybaGhaffar1
Python programminglanguage
Python programminglanguage
cedriccjmusic
Java Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
OXUS 20
ptes oral pathology by deds deds des.pptx
ptes oral pathology by deds deds des.pptx
SamanArshad11
First game using c language
First game using c language
Saurabh Khetan
Python in details
Python in details
Khalid AL-Dhanhani
Magic 8 ball putting it all together
Magic 8 ball putting it all together
geekinlibrariansclothing
Guess a number game
Guess a number game
Willie Barnes
Sasin nisar
Sasin nisar
SasinNisar
RandomGuessingGame
RandomGuessingGame
Christopher Singleton
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
Ruth Marvin
Modul 1 Scratch
Modul 1 Scratch
Ministry of Education Malaysia
Mon guess my number
Mon guess my number
Caroline Meeks
Yet another building metaphor
Yet another building metaphor
Aslam Khan
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
pankajkumbara
Week3.pptx
Week3.pptx
WillSephton
Scratch programmingconcepts v14
Scratch programmingconcepts v14
Miguel Zambrano
PyCon2009_AI_Alt
PyCon2009_AI_Alt
Hiroshi Ono
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
ShamithRai
Industrial Control System Assignment Help|25% Online Assignment Help
Industrial Control System Assignment Help|25% Online Assignment Help
Nicole Valerio
CSP1150D Programming Principles
CSP1150D Programming Principles
Nicole Valerio
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
jacoba18
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
vemulavenu484

More Related Content

Similar to PYTHON 1 system guessing game for python.pptx (20)

Python programminglanguage
Python programminglanguage
cedriccjmusic
Java Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
OXUS 20
ptes oral pathology by deds deds des.pptx
ptes oral pathology by deds deds des.pptx
SamanArshad11
First game using c language
First game using c language
Saurabh Khetan
Python in details
Python in details
Khalid AL-Dhanhani
Magic 8 ball putting it all together
Magic 8 ball putting it all together
geekinlibrariansclothing
Guess a number game
Guess a number game
Willie Barnes
Sasin nisar
Sasin nisar
SasinNisar
RandomGuessingGame
RandomGuessingGame
Christopher Singleton
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
Ruth Marvin
Modul 1 Scratch
Modul 1 Scratch
Ministry of Education Malaysia
Mon guess my number
Mon guess my number
Caroline Meeks
Yet another building metaphor
Yet another building metaphor
Aslam Khan
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
pankajkumbara
Week3.pptx
Week3.pptx
WillSephton
Scratch programmingconcepts v14
Scratch programmingconcepts v14
Miguel Zambrano
PyCon2009_AI_Alt
PyCon2009_AI_Alt
Hiroshi Ono
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
ShamithRai
Industrial Control System Assignment Help|25% Online Assignment Help
Industrial Control System Assignment Help|25% Online Assignment Help
Nicole Valerio
CSP1150D Programming Principles
CSP1150D Programming Principles
Nicole Valerio
Python programminglanguage
Python programminglanguage
cedriccjmusic
Java Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
OXUS 20
ptes oral pathology by deds deds des.pptx
ptes oral pathology by deds deds des.pptx
SamanArshad11
First game using c language
First game using c language
Saurabh Khetan
Guess a number game
Guess a number game
Willie Barnes
Sasin nisar
Sasin nisar
SasinNisar
Mastering Python lesson3b_for_loops
Mastering Python lesson3b_for_loops
Ruth Marvin
Mon guess my number
Mon guess my number
Caroline Meeks
Yet another building metaphor
Yet another building metaphor
Aslam Khan
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
COMPUTER SCIENCE INVESTIGATORY PROJECT ON FOOTBALL GAME AND SCORE MANAGEMENT ...
pankajkumbara
Scratch programmingconcepts v14
Scratch programmingconcepts v14
Miguel Zambrano
PyCon2009_AI_Alt
PyCon2009_AI_Alt
Hiroshi Ono
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
s-INTRODUCTION TO PROBLEM SOLVING PPT.pptx
ShamithRai
Industrial Control System Assignment Help|25% Online Assignment Help
Industrial Control System Assignment Help|25% Online Assignment Help
Nicole Valerio
CSP1150D Programming Principles
CSP1150D Programming Principles
Nicole Valerio

Recently uploaded (20)

Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
jacoba18
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
vemulavenu484
Power BI API Connectors - Best Practices for Scalable Data Connections
Power BI API Connectors - Best Practices for Scalable Data Connections
Vidicorp Ltd
5. & 9. Packing material and Labelling_AP-60,XP-60.pdf
5. & 9. Packing material and Labelling_AP-60,XP-60.pdf
maricruzduranpaterni
Untitled presentation xcvxcvxcvxcvx.pptx
Untitled presentation xcvxcvxcvxcvx.pptx
jonathan4241
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
Section Three - Project colemanite production China
Section Three - Project colemanite production China
VavaniaM
KLIP2Data voor de herinrichting van R4 West en Oost
KLIP2Data voor de herinrichting van R4 West en Oost
jacoba18
Hypothesis Testing Training Material.pdf
Hypothesis Testing Training Material.pdf
AbdirahmanAli51
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
OlhaTatokhina1
Verweven van EM Legacy en OTL-data bij AWV
Verweven van EM Legacy en OTL-data bij AWV
jacoba18
FME Beyond Data Processing: Creating a Dartboard Accuracy App
FME Beyond Data Processing: Creating a Dartboard Accuracy App
jacoba18
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
Ameya Patekar
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
rinzindorjej
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
REGRESSION DIAGNOSTIC I: MULTICOLLINEARITY
REGRESSION DIAGNOSTIC I: MULTICOLLINEARITY
Ameya Patekar
Module 1Integrity_and_Ethics_PPT-2025.pptx
Module 1Integrity_and_Ethics_PPT-2025.pptx
Karikalcholan Mayavan
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
jacoba18
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
SAP_S4HANA_EWM_Food_Processing_Industry.pptx
vemulavenu484
Power BI API Connectors - Best Practices for Scalable Data Connections
Power BI API Connectors - Best Practices for Scalable Data Connections
Vidicorp Ltd
5. & 9. Packing material and Labelling_AP-60,XP-60.pdf
5. & 9. Packing material and Labelling_AP-60,XP-60.pdf
maricruzduranpaterni
Untitled presentation xcvxcvxcvxcvx.pptx
Untitled presentation xcvxcvxcvxcvx.pptx
jonathan4241
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
Section Three - Project colemanite production China
Section Three - Project colemanite production China
VavaniaM
KLIP2Data voor de herinrichting van R4 West en Oost
KLIP2Data voor de herinrichting van R4 West en Oost
jacoba18
Hypothesis Testing Training Material.pdf
Hypothesis Testing Training Material.pdf
AbdirahmanAli51
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays New York 2025 - Using GraphQL SDL files as executable API Contracts b...
apidays
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
OlhaTatokhina1
Verweven van EM Legacy en OTL-data bij AWV
Verweven van EM Legacy en OTL-data bij AWV
jacoba18
FME Beyond Data Processing: Creating a Dartboard Accuracy App
FME Beyond Data Processing: Creating a Dartboard Accuracy App
jacoba18
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
REGRESSION DIAGNOSTIC II: HETEROSCEDASTICITY
Ameya Patekar
11th International Conference on Data Mining (DaMi 2025)
11th International Conference on Data Mining (DaMi 2025)
rinzindorjej
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
REGRESSION DIAGNOSTIC I: MULTICOLLINEARITY
REGRESSION DIAGNOSTIC I: MULTICOLLINEARITY
Ameya Patekar
Module 1Integrity_and_Ethics_PPT-2025.pptx
Module 1Integrity_and_Ethics_PPT-2025.pptx
Karikalcholan Mayavan
Ad

PYTHON 1 system guessing game for python.pptx

  • 1. West Visayas State University Calinog Campus SCHOOL OF INFORMATION AND COMMUNICATIONS TECHNOLOGY Number Guessing game In partial fulfillment CC203 PORGRAMMING II as a requirements for Bachelor of Science in Information Technology by Deon Raphael G. Palma JC France Catalogo Dennis Libuna SY 2024-2025 2nd Semester
  • 2. Number Guessing game I. BRIEF INTRODUCTION The number guessing game is a classic introduction to programming concepts like loops, conditional statements, and user input. It's a fun and engaging way to learn the fundamentals of coding. In this game, the computer generates a random number within a specific range. The player then tries to guess the number by entering their own guesses. The program provides feedback to the player indicating if their guess is too high, too low, or correct. The game continues until the player guesses the correct number.
  • 3. II. PURPOSE AND DESCRIPTION Goal: The player tries to guess a hidden number chosen by the computer. Mechanics: The computer generates a random number within a specific range. The player keeps guessing numbers until they guess the correct number. Feedback: After each guess, the game provides feedback indicating if the guess is too high or too low. Looping: The program continues to prompt the user for guesses until they guess the correct number. Entertainment: The guessing game is a fun and engaging way to pass the time.
  • 4. III. FUNCTIONAL FEATURES Random Number Generation: The program uses the random module to generate a secret number. User Input: The program prompts the user to enter their guess. Guess Evaluation: It compares the user's guess with the hidden number. Feedback Loop: The program provides feedback ("Too high" or "Too low") based on the guess. Win/Lose conditions: The program can determine if the user has guessed the correct number and provide congratulatory or informative messages accordingly. Play again functionality: The program allows the user to choose whether they want to restart the game after each round.
  • 6. V. SOURCE CODE import random # Import the random library to generate random numbers while True: # Loop to keep playing until user decides to quit # Game logic here num = random.randint(1, 10) # Generate a random number between 1 and 10 guess = 0 # Initialize guess variable to 0 while guess != num: # Loop until the user guesses the correct number guess = input("Guess a number between 1 and 10: ") # Ask for user's guess guess = int(guess) # Convert the guess input (string) to an integer if guess < num: # Check if guess is too low print("Too low, try again.") elif guess > num: # Check if guess is too high print("Too high, try again.") print("Congratulations! You guessed the number correctly!") # Congratulate player def play_again(): """Asks the user if they want to play again.""" while True: choice = input("Do you want to play again? (y/n): ").lower() if choice in ("y", "n"): # Check for valid input (y or n) return choice == "y" # Return True if user wants to play again else: print("Invalid input. Please enter 'y' or 'n'.") # Play again prompt if not play_again(): # Check if user doesn't want to play again break # Exit the loop and end the game print("Thanks for playing!") # Thank the player for playing