STANSFORD INTERNATIONAL HIGHER SECONDARY SCHOOL
Pitchaveeranpet, Moolakulam,
Puducherry – 605110.
A MINI GAME HUB USING PYTHON
An investigatory project submitted towards partial fulfillment of credit for
The Senior School Certificate Computer Science Practical Examination-2026.
Submitted by
R. GRIESH
Grade XII-B
(2025-2026)
Reg. No.: ___________________
Under the guidance of
Mrs. RAJESWARI S
Post Graduate Teacher –Computer Science
BONAFIDE CERTIFICATE
This is to certify that R. GRIESH bearing Register Number :
____________________ is student of class XII-B, Stansford International
Higher Secondary School,Pitchaveeranpet, Moolakulam, Puducherry has
completed the investigatory project entitled “A MINI GAME HUB USING
PYTHON” during the academic year 2025-2026 towards the partial fulfillment
of credit for the Computer Science Practical Examination of Senior School
Certificate Examination and submitted satisfactory report, as compiled in the
following pages, under my guidance.
Internal Examiner
Countersigned by
The Principal External Examiner
.
DECLARATION
I hereby declare that the investigatory project work entitled “A MINII
GAME HUB USING PYTHON” submitted to the Department of Computer
Science, Stansford International Higher Secondary School, Pitchaveeranpet,
Moolakulam, Puducherry is prepared by me. All the works are the result of my
personal efforts. This work has not been previously submitted for any other
purpose.
R. GRIESH
ACKNOWLEDGEMENT
I would like to express a deep sense of gratitude to Mrs. Preethi T,
our Principal for her coordination, in extending every possible support for the
completion of this project.
My sincere thanks to my project guide Mrs. RAJESWARI Sfor guiding
me immensely through the course of project. She always evinced keen interest
in my work. Her conservative advice and constant motivation have been helpful
for the successful completion of the project.
I also thank my parents and my class teacher for their motivation and
support. I thank my class mates for their timely help and support for the
completion of the project.
I would like to thank all those who had helped directly or indirectly
towards the completion of this project.
R. GRIESH
TABLE OF CONTENT
[Link] Name of The Content [Link]
1 INTRODUCTION 1
2 OBJECTIVE 1
3 SOFTWARE USED 1
4 MODULES USED 1
5 SOURCE CODE 2
6 OUTPUT 11
7 RESULT 14
8 BIBLIOGRAPHY 15
INTRODUCTION:
To construct a mini game hub using python to play stone, paper, scissors
or Guessing the Number and Quiz Game.
OBJECTIVE:
To make python interactive to users and play game with python as well
has learning Python coding.
SOFTWARE USED:
1)PYTHON
2)Use of Two files:
a)[Link]
b)[Link]
MODULES USED:
1)Random module
2)CSV module
3)OS module
SOURCE CODE:
import random
import csv
import os
CSV_QUESTIONS = "[Link]"
CSV_ANSWERS = "[Link]"
def clear_screen():
# simple newline clear for portability
print("\n" * 2)
# --------------------
# Stone / Paper / Scissors (first to 5 wins)
# --------------------
def play_rps():
choices = {"s": "scissors", "p": "paper", "st": "stone"}
player_score = 0
comp_score = 0
print("You chose Stone/Paper/Scissors. First to 5 wins.")
while player_score < 5 and comp_score < 5:
move = input("Enter scissors as s, paper as p and stone as st:
").strip().lower()
if move not in choices:
print("Invalid choice. Use s, p or st.")
continue
comp_move = [Link](list([Link]()))
print(f"you chose {choices[move]}")
if choices[move] == comp_move:
print(f"the computer has also kept the same {comp_move}")
else:
# determine winner
win_pairs = {
("scissors", "paper"),
("paper", "stone"),
("stone", "scissors")
if (choices[move], comp_move) in win_pairs:
player_score += 1
print(f"you win computer kept {comp_move}")
else:
comp_score += 1
print(f"you lose computer kept {comp_move}")
print("your score is", player_score, "computer score is", comp_score)
if comp_score > player_score:
print("computer has won the round")
else:
print("Congratulations!you won the round")
# --------------------
# Guess the Number
# --------------------
def play_guess_number():
secret = [Link](1, 100)
print("Welcome to guessing the number game")
print("In this game the computer will pick a number from 1 to 100 and
you should guess it")
print("There will be 10 chances and the computer will help you with
hints.")
for attempt in range(1, 11):
try:
guess = int(input(f"Enter the number (attempt {attempt}/10): "))
except ValueError:
print("Invalid input — enter an integer.")
continue
if guess < 1 or guess > 100:
print("invalid number")
continue
if guess == secret:
print("Congratulations!,you have found the correct answer picked
by the computer", secret)
return
elif guess > secret:
print("The number is less than", guess)
else:
print("The number is more than", guess)
print("Your chance has been completed and the number picked by
computer is", secret)
# --------------------
# Quiz: load/add/play
# --------------------
def load_quiz_data():
questions = []
answers = []
# Load questions
if [Link](CSV_QUESTIONS):
with open(CSV_QUESTIONS, newline="", encoding="utf-8") as fq:
reader = [Link](fq, delimiter="|")
for row in reader:
if len(row) >= 2:
[Link]((row[0], row[1]))
# Load answers
if [Link](CSV_ANSWERS):
with open(CSV_ANSWERS, newline="", encoding="utf-8") as fa:
reader = [Link](fa, delimiter="|")
for row in reader:
if row:
[Link](row[0])
return questions, answers
def add_quiz_questions():
PASSWORD = "Pass_in"
entered = input("Enter the password: ")
if entered != PASSWORD:
print("Incorrect password.")
return
try:
n = int(input("Enter the number of questions to add: "))
except ValueError:
print("Invalid number.")
return
with open(CSV_QUESTIONS, "a", newline="", encoding="utf-8") as fq, \
open(CSV_ANSWERS, "a", newline="", encoding="utf-8") as fa:
q_writer = [Link](fq, delimiter="|")
a_writer = [Link](fa, delimiter="|")
for _ in range(n):
question = input("Enter the question: ").strip()
options = input("Enter the options (comma separated): ").strip()
correct_answer = input("Enter the correct answer (exact option
text): ").strip()
q_writer.writerow([question, options])
a_writer.writerow([correct_answer])
print(f"{n} question(s) added successfully.")
def play_quiz():
questions, answers = load_quiz_data()
if not questions or not answers:
print("No questions available. Add some questions first.")
return
score = 0
asked = set()
rounds = min(5, len(questions))
for _ in range(rounds):
# choose unasked index
while True:
idx = [Link](len(questions))
if idx not in asked:
[Link](idx)
break
q_text, opts_text = questions[idx]
options = [[Link]() for o in opts_text.split(",") if [Link]()]
print("\nQuestion:", q_text)
for i, opt in enumerate(options, start=1):
print(f"{i}. {opt}")
try:
user_choice = int(input("Enter your option number: "))
picked = options[user_choice - 1].strip().lower()
correct = answers[idx].strip().lower() if idx < len(answers) else ""
if picked == correct:
print("Correct answer!")
score += 1
else:
print(f"Wrong! Correct answer: {answers[idx] if idx < len(answers)
else 'N/A'}")
except (ValueError, IndexError):
print("Invalid input. Skipping question.")
print(f"\nYour final score: {score}/{rounds}")
# --------------------
# Main menu
# --------------------
def main():
while True:
print("\n=== MINI GAME HUB ===")
print("1: stone,paper,scissor")
print("2: guess the number")
print("3: Quiz game")
print("4: Exit")
try:
choice = int(input("enter the choice: "))
except ValueError:
print("Please enter a number 1-4.")
continue
if choice == 1:
play_rps()
elif choice == 2:
play_guess_number()
elif choice == 3:
while True:
print("\n===== Quiz Menu =====")
print("1: Add Questions")
print("2: Play Quiz")
print("3: Back to Main Menu")
try:
q_choice = int(input("Enter your choice: "))
except ValueError:
print("Invalid input.")
continue
if q_choice == 1:
add_quiz_questions()
elif q_choice == 2:
play_quiz()
elif q_choice == 3:
break
else:
print("Invalid choice. Try again.")
elif choice == 4:
print("Bye!")
break
else:
print("Invalid choice. Try again.")
if __name__ == "__main__":
main()
OUTPUT:
a)To play stone,paper,scissors.
b)To play guessing the number.
c)to play quiz
1)To add Questions:
2)To play Quiz:
RESULT:
The program is executed successfully and outputs are shown.
BIBLIOGRAPHY:
1) [Link]
2) [Link]
3) [Link]
with-Python-12th-Sumita-Arora-pdf
4) [Link]