Investigatory Project for
Session Ending Exam -2023-24
Computer Science(083)
Practical Exam
Student Information
Name: Sagnik Bhowmik
Class: 11TH - A
Admission No: 2645
Topic: Word Guessing Game
Subject Teacher: Mr. ARIJIT GHOSH
School: PM SHRI KV Cossipore
1
ACKNOWLEGEMENT
I would like express my special gratitude to our
Principal Shri. K. K. Dubey, our teacher cum guide
Mr. Arijit Ghosh and other teachers’ of the school
who gave me guidance to complete this project. Also
I am thankful to the various Internet sites and my
school Library from where I could get instant help
whenever I got stuck in the course of completing the
project.
I consider myself lucky to have such a wonderful
batch of classmates whose motivation and help made
it possible for me to complete this project within the
given time frame.
Student Signature
2
CERTIFICATE
This is to certify that this investigatory project work
in the subject of Computer Science has been done by
_____________ of class 11th –A in the academic year
2023-24 for S.S.E. Practical Examination conducted
on ____________ The student has successfully
completed the project in Computer Science under
guidance of Mr. Arijit Ghosh as per the syllabus
prescribed by CBSE .
_____________________________
Signature of Internal Examiner
____________________
Principal’s Signature
3
CONTENT / INDEX
4
INTRODUCTION
In this project, I have embarked on the exciting
journey of creating a word guessing game using
Python.The project revolves around crafting a word
guessing game where players attempt to unravel a
hidden word through a series of guesses. The game
will challenge players to leverage their vocabulary
and deduction skills, adding an educational element
to the entertainment. The decision to undertake the
development of a word guessing game in Python
stems from a combination of personal interest and
practical learning objectives. Games have an inherent
appeal due to their interactive nature, making them a
captivating way to apply programming concepts.
In conclusion the journey of developing a word
guessing game in Python is not just a quest for
entertainment but a deliberate effort to enhance
programming skills, explore the capabilities of the
python language and most importantly have fun in
the process.
5
MINIMUM SYSTEM REQUIREMENTS:
Operating System Windows 10
CPU I5 Processor
RAM 4 GB
Software
Frontend Python
Hard Drive 512 GB
PYTHON CODE
6
import pygame
from pygame import mixer
mixer.init()
mixer.music.load('C:/Users/Rupu/Downloads/the-epic-2-by-rafael-krux(chosic.com).mp3')
mixer.music.play()
import random
def isword(guess,wordly_word):
for x in guess:
print(x,end="")
def read_words_from_file(file_name):
with open(file_name, "r") as file:
words = file.read().splitlines()
return words
words=read_words_from_file("C:\\Users\\Rupu\\Downloads\\words.txt")
word = random.choice(words)
print(" \n Welcome to word guessing game")
print(f"The word has {len(word)} letters")
message,max_attempts = {0:"Marvellous",1:"Excellent",2:"Very
good",3:"Nice",4:"Good",5:"Ok"},6
print(f"you have {max_attempts} attempts to guess the word")
words1=word.split()
for i in words1:
n=i[0]
if n in ('a', 'e', 'i', 'o', 'u'):
print("The first letter of word is vowel")
else:
print('The first letter of the word is consonsont')
while max_attempts>=0:
guess=input("\nEnter your guess: ")
if len(guess)==7 and guess.isalpha():
print("You guessed wrong")
print("The word has",len(word),"letters!!!")
continue
if guess in word:
print("Congratulations! You guessed the word correctly")
print(random.choice(message))
print("Thank you for participating in this game")
break
elif max_attempts<=6 and max_attempts>4:
print("you guessed wrong!!")
7
max_attempts-=1
print("Attempts left:", max_attempts)
print("Here is your clue")
for i in words1:
print("The first letter of the word is",i[0])
continue
elif max_attempts==4:
max_attempts-=1
print("Attempts left:", max_attempts)
print("you guessed wrong!!")
print("Here is your another clue")
for i in words1:
q=i[1]
if q in ('a', 'e', 'i', 'o', 'u'):
print("The second letter of word is vowel")
else:
print('The second letter of the word is consonsont')
continue
elif max_attempts==3:
max_attempts-=1
print("Attempts left:", max_attempts)
print("you guessed wrong!!")
print("Here is your another clue")
for i in words1:
print("The second letter of the word is",i[1])
continue
elif max_attempts<3 and max_attempts>1:
print("you guessed wrong!!")
max_attempts-=1
print("Attempts left:", max_attempts)
print("Here is your another clue")
for i in words1:
print("The last letter of the word is",i[len(word)-1])
continue
else:
print("You guessed wrong!!")
print("\nBetter luck next time")
print("The correct word is",word)
print("Thank you for participating in this game")
print(exit())
8
Output-
pygame 2.5.2 (SDL 2.28.3, Python 3.11.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Welcome to word guessing game
The word has 4 letters
you have 6 attempts to guess the word
The first letter of the word is consonsont
Enter your guess: doll
you guessed wrong!!
Attempts left: 5
Here is your clue
The first letter of the word is t
Enter your guess: trot
you guessed wrong!!
Attempts left: 4
Here is your clue
The first letter of the word is t
Enter your guess: treat
Attempts left: 3
you guessed wrong!!
Here is your another clue
The second letter of the word is consonsont
Enter your guess: trek
Attempts left: 2
you guessed wrong!!
Here is your another clue
The second letter of the word is r
Enter your guess: tree
Congratulations! You guessed the word correctly
Excellent
Thank you for participating in this game
9
FEATURES OF THE PROJECT
Potential features for your word guessing game
project :-
1.Word Database : A comprehensive database of
words from various categories ensures a diverse and
engaging gameplay experience.
2. User Friendly Interface : The game boasts an
intuitive and visually appealing interface, making it
accessible to players of all ages and skill levels.
3. Difficulty Levels : Adjustable difficulty levels cater
to different skill levels, offering both casual and
challenging gameplay options.
4. Hint System : Players can use hints to get clues
about the hidden word, adding an extra layer of
strategy to the game.
5. Sound Effects : Enhance the gaming experience
with sound effects for correct and incorrect guesses,
as well as for winning and losing scenarios.
6. Educational Value : Beyond entertainment, the
game serves as a tool for vocabulary building and
cognitive development, making it both fun and
enriching.
10
FUTURE SCOPE OF THE PROJECT
The future scope of the word guessing game project
involves incorporating advanced features to elevate
the gaming experience. Integration of a dynamic
database for an extensive word library and
customizable difficulty levels would enhance
gameplay. Implementation of a multiplayer mode,
enabling users to compete or collaborate in real-
time, is another exciting prospect. Enhanced
graphics, sound effects, and a more intuitive user
interface could be added for a visually appealing and
immersive experience. Additionally, exploring the
integration of machine learning algorithms to adapt
the game's difficulty based on individual player
performance could further personalize the gaming
journey. Continuous updates to expand the word
database and periodic challenges could keep the
game fresh and engaging for users, ensuring long-
term interest and enjoyment.
11
BIBLIOGRAPHY
www.google.com
A text book for class XI Computer Science by
Sumita Arora
12