CHARACTER GUESSER
Project Report submitted to Shri Vidhya Mandhir, Pushpathur, Pushpathur, Palani, in partial
fulfilment of the requirement for the award of
SENIOR SECONDARY
SUBJECT IN
COMPUTER SCIENCE
Submitted By
SANJAY KUMAR S (ROLL.NO:
Under the Guidance of
Mrs. P. Jeyanthi Rani M.Sc (CS & IT).,B.Ed.,M.Phil.,
Department of Computer Science
1
BONAFIDE CERTIFICATE
This is to certify that the project report entitled “CHARACTER GUESSER” is
a bonafide work done by Selvan SANJAY KUMAR.S of grade12 in
partial fulfilment of the requirement for the award of senior secondary of Shri Vidhya
Mandhir during the academic year 2023-24.
PRINCIPAL PROJECT GUIDE
Submitted for the Viva-Voce examination held on ______________________
at Department of Computer Science, Shri Vidhya Mandhir, Pushpathur, Palani.
EXTERNAL EXAMINER INTERNAL EXAMINER
2
DECLARATION
I hereby declare that the project work entitled
‘CHARACTER GUESSER’
submitted to Department of Computer Science ,
Shri Vidhya Mandhir CBSE school, Pushpathur,
Palani is prepared by me. All the coding is the result of my
personal effort.
SANJAY KUMAR.S
3
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my
gratitude to the people who have been instrumental in the successful completion of this
project. I express deep sense of gratitude to almighty God for giving me strength for the
successful completion of the project.
I express my heartfelt gratitude to my parents for constant encouragement while
carrying out this project.
I gratefully acknowledge the contribution of the individuals who contributed in bringing
this project up to this level, who continues to look after me despite my flaws.
I express my deep sense of gratitude to the luminary, The Management, The Principal
Vasantha.B, M.Sc., M.A., B.Ed., Shri Vidhya Mandhir who has been continuously
motivating and extending their helping hand to us.
I express my sincere thanks to the academician The Co-ordinator and all other supportive
teachers of Shri Vidhya Mandhir for constant encouragement and the guidance provide
during this project.
I am overwhelmed to express my thanks to the Management for providing me an
infrastructure and moral support while carrying out this project in the school.
My sincere thanks to Mrs. Jeyanthi Rani, MSc., B.Ed., M.Phil., Project In-charge, A
guide, Mentor all the above a friend, who critically reviewed my project and helped in
solving each and every problem, occurred during implementation of the project.
The guidance and support received from all the members who contributed and who are
contributing to this project, was vital for the success of the project. I am grateful for their
constant support and help.
SANJAY KUMAR.S
4
INDEX
Content Page .no
1. Synopsis 11
2. Objective of the Program 22
3. About Python 12
4. Source Code
33
5. Output
22
5
SYNOPSIS
The TeacherGuess Python program is an innovative project designed to emulate
the popular Akinator game by applying a similar concept to guess the names of
teachers. Utilizing the power of Python, this program combines algorithmic
decision-making with user interactions to accurately predict a teacher's name
based on a series of strategically crafted questions.
6
OBJECTIVE OF THE PROGRAM
The objective of the TeacherGuess Python program is to create a captivating and
user-friendly application that employs algorithmic decision-making to guess the
names of teachers.
The program seeks to engage users in an interactive experience, prompting them
with carefully crafted questions related to teachers' characteristics. Through the
implementation of a dynamic algorithm, the program adapts its questioning
strategy based on user responses, continually refining its ability to make accurate
predictions.
A comprehensive database ensures the program's versatility in guessing teachers
from various educational backgrounds. The objective also includes promoting
user customization, allowing individuals to tailor the program to their
preferences. Furthermore, the program aims to strike a balance between
entertainment and education, introducing users to the capabilities of algorithmic
intelligence in a programming context. The integration of a feedback mechanism
facilitates user input, contributing to ongoing improvements and enhancing
overall user satisfaction.
Ultimately, the TeacherGuess program serves as an engaging demonstration of
Python's versatility in creating intelligent and interactive applications.
7
ABOUT PYTHON
Python is a high-level, interpreted, and general-purpose programming language
that emphasizes readability and simplicity. It supports multiple paradigms, such
as object-oriented, procedural, functional, and imperative programming. Python
is often used for scripting, web development, data analysis, machine learning,
and automation. Python has a large and comprehensive standard library that
provides built-in modules for common tasks, such as input/output, networking,
databases, cryptography, and GUI development.
Python also has a rich ecosystem of third-party libraries and frameworks that
extend its functionality and offer specialized solutions for various domains. Some
of the most popular ones are NumPy, SciPy, Pandas, TensorFlow, Django, Flask,
and PyTorch.
8
SOURCE CODE
import random
import tkinter as tk
from PIL import Image, ImageTk
print("Hello ! This Program is about Guessing character(Teachers) in SVM , I tried adding
all of them but time didn't allow me to input huge data into this project .")
print("")
print("")
print("In this program , I will be asking few questions about staffs who work in Shri Vidhya
Mandhir and try guessing the character")
print("")
print("")
print("For YES as your answer enter either yes or y ")
print(“For No as your answer enter no or n”)
print("")
print("")
#Displaying the Image of character
def output(Name, text):
global image_label
root = tk.Tk()
root.title("Image Display with Text")
image_path = ""
if image_path !="":
image = Image.open(image_path)
photo = ImageTk.PhotoImage(image)
image_label = tk.Label(root, image=photo)
image_label.image = photo # To prevent garbage collection
text_label = tk.Label(root, text=text, font=("Helvetica", 16))
9
text_label.pack(padx=50,pady=50)
if image_path != "":
image_label.pack()
root.update_idletasks()
width = root.winfo_width()
height = root.winfo_height()
x = (root.winfo_screenwidth() // 2) - (width // 2)
y = (root.winfo_screenheight() // 2) - (height // 2)
root.geometry('{}x{}+{}+{}'.format(width, height, x, y))
root.mainloop()
#Non-Teaching Staffs
TeachCat = str.lower(input("Enter whether the staff teach classes (YES / NO) : "))
if TeachCat == "no" or "n":
Atts = [{"Name": "Bala sir", "InSCH" : True ,"Female" : False, "Garden" : False ,
"Drive" : False , "Print" : True , "HostStudy" : False , "Office": True , "Sports" : False},
{"Name": "Dharineesh sir", "InSCH" : True ,"Female" : False, "Garden" : False ,
"Drive" : False , "Print" : True , "HostStudy" : True , "Office": False , "Sports" : True},
{"Name": "Karthikeyan sir", "InSCH" : True ,"Female" : False, "Garden" : False ,
"Drive" : False , "Print" : False , "HostStudy" : False , "Office": True, "Sports" : False},
{"Name": "Principal mam ", "InSCH" : True ,"Female" : True, "Garden" : False ,
"Drive" : False , "Print" : False , "HostStudy" : False , "Office": True , "Sports" : False},
{"Name": "Rajalingam Sir", "InSCH" : True ,"Female" : False, "Garden" : False ,
"Drive" : False , "Print" : False , "HostStudy" : True , "Office": False , "Sports" : False}]
10
def guess_my_character(answer, key):
if answer == "yes" or "y":
response = True
elif answer == "no" or "n":
response = False
filter = []
for j in Atts:
if j[key] != response:
filter.append(j)
for i in filter:
Atts.remove(i)
if len(Atts) == 1:
text = ("\n\nYour character is " + Atts[0]["Name"])
output(Atts[0]["Name"],text)
quit()
def ask_questions(questions, questions2, keys):
# Randomize the order of questions
random.shuffle(questions2)
asked_questions = set()
for question in questions2:
11
if question not in asked_questions:
asked_questions.add(question)
user_input = str.lower(input(question + " : "))
if user_input is not "yes" or "no":
print("Enter only yes or y / no or n")
break
x = (keys[questions.index(question)])
guess_my_character(user_input, x)
questions_list = [
"Does Your Character Work inside the school (Yes/No): ",
"Is Your Character a Female (Yes/No): ",
"Does Your Character Take Care of the Garden (Yes/No): ",
"Does Your Character Drive Vans (Yes/No): ",
"Does Your Character Take Print Outs (Yes/No) : ",
"Does Your Character take care of Hostel Studies (Yes/No) : ",
"Does Your Character Do Official works for the School : ",
"Is Your Character Good At Sports (Yes/No): "
]
questions_list2 = [
"Does Your Character Work inside the school (Yes/No): ",
12
"Is Your Character a Female (Yes/No): ",
"Does Your Character Take Care of the Garden (Yes/No): ",
"Does Your Character Drive Vans (Yes/No): ",
"Does Your Character Take Print Outs (Yes/No) : ",
"Does Your Character take care of Hostel Studies (Yes/No) : ",
"Does Your Character Do Official works for the School : ",
"Is Your Character Good At Sports (Yes/No): "
]
keys = ["InSCH", "Female", "Garden", "Drive", "Print", "HostStudy", "Office",
"Sports"]
(ask_questions(questions_list, questions_list2, keys))
elif TeachCat == "yes" or "y" :
Atts = [{"Name": "Pavan Sir","Class12/11" : True , "SubMaths" : True , "Sports" :
True , "SubChem": False , "SubPhy": False ,"Arts" : False , "PhyEdu" : False , "SubBio" :
False , "ClassTeach":False , "English" : False , "Coord" : False , "Female" : False,
"ImgMinds" : False, "Basketball" : False ,"Football" : False},
13
{"Name": "Reddy Sir", "Class12/11" : True , "SubMaths" : False , "Sports" : True
, "SubChem": True , "SubPhy": False ,"Arts" : False , "PhyEdu" : False , "SubBio" : False
, "ClassTeach":False , "English" : False, "Coord" : False, "Female" : False, "ImgMinds" :
False, "Basketball" : False , "Football" : False},
{"Name": "Anthony Sir", "Class12/11" : True , "SubMaths" : False , "Sports" :
False , "SubChem": False , "SubPhy": True ,"Arts" : False , "PhyEdu" : False , "SubBio" :
False , "ClassTeach":False , "English" : False, "Coord" : False, "Female" : False,
"ImgMinds" : False, "Basketball" : False , "Football" : False},
{"Name": "Vasudevan Sir", "Class12/11" : True ,"SubMaths" : False , "Sports" :
False , "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False , "SubBio" :
True , "ClassTeach":False , "English" : False , "Coord" : False, "Female" : False,
"ImgMinds" : False, "Basketball" : False , "Football" : False},
{"Name": "Subash Sir", "Class12/11" : True,"SubMaths" : False , "Sports" :
False , "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False , "SubBio" :
False , "ClassTeach":True , "English" : True , "Coord" : True, "Female" : False,
"ImgMinds" : False, "Basketball" : False , "Football" : False},
{"Name": "Jeyanthi Rani Mam ", "Class12/11" : True ,"SubMaths" : False ,
"Sports" : False , "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False ,
"SubBio" : False , "ClassTeach":True , "English" : False , "Coord" : False, "Female" :
True, "ImgMinds" : False, "Basketball" : False ,"Football" : False },
{"Name": "Prasanth Sir", "Class12/11" : True ,"SubMaths" : True, "Sports" :
True , "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False , "SubBio" :
False , "ClassTeach":True , "English" : False , "Coord" : True, "Female" : False,
"ImgMinds" : False, "Basketball" : False , "Football" : False},
{"Name": "Uma Rani Mam", "Class12/11" : False ,"SubMaths" : True, "Sports" :
False , "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False , "SubBio" :
False , "ClassTeach":True , "English" : False , "Coord" : False, "Female" : True,
"ImgMinds" : False, "Basketball" : False ,"Football" : False},
{"Name": "Sumathi Mam", "Class12/11" : True ,"SubMaths" : False, "Sports" :
False , "SubChem": False , "SubPhy": False ,"Arts" : True, "PhyEdu" : False , "SubBio" :
False , "ClassTeach":True , "English" : False , "Coord" : True, "Female" : True,
"ImgMinds" : False, "Basketball" : False , "Football" : False},
14
{"Name": "Karan Sir", "Class12/11" : False ,"SubMaths" : False, "Sports" : True
, "SubChem": False , "SubPhy": False ,"Arts" : False, "PhyEdu" : False , "SubBio" : False
, "ClassTeach":True , "English" : False , "Coord" : False, "Female" : True , "ImgMinds" :
True , "Basketball" : False , "Football" : False},
{"Name": "Vignesh Sir", "Class12/11": False, "SubMaths": False, "Sports": True,
"SubChem": False, "SubPhy": False, "Arts": False, "PhyEdu": True, "SubBio": False,
"ClassTeach": True, "English": False, "Coord": False, "Female": False, "ImgMinds": False
, "Basketball" : True , "Football" : False} ,
{"Name": "Arun Sir", "Class12/11": False, "SubMaths": False, "Sports": False ,
"SubChem": False, "SubPhy": False, "Arts": False, "PhyEdu": True, "SubBio": False,
"ClassTeach": False , "English": True, "Coord": True, "Female": False, "ImgMinds": False
, "Basketball" : False, "Football" : False} ]
def guess_my_character(answer, key):
if answer == "yes" or "y":
response = True
elif answer == "no" or "n":
response = False
filter = []
for j in Atts:
if j[key] != response:
filter.append(j)
for i in filter:
Atts.remove(i)
if len(Atts) == 1:
text = ("\n\nYour character is " + Atts[0]["Name"])
output(Atts[0]["Name"], text)
quit()
15
def ask_questions(questions, questions2, keys):
# Randomize the order of questions
random.shuffle(questions2)
asked_questions = set()
for question in questions2:
if question not in asked_questions:
asked_questions.add(question)
user_input = str.lower(input(question + " : "))
if user_input is not "yes" or "no" :
print("Enter only yes or y / no or n")
break
x = (keys[questions.index(question)])
guess_my_character(user_input, x)
questions_list = [
"Does Your Character teach for Class 11 / 12 (Yes/No): ",
"Does your character teach Maths for students(Yes/No): ",
"Does your character involve in sports with students (Yes/No) : ",
"Does your Character teach Chemistry for students (Yes/No) :",
16
"Does your Character teach Physics for students (Yes/No) :",
"Does your character teach for Class 11 / 12 Arts (Yes/No) :",
"Does your character teach physical education(PT) (Yes/No) :",
"Does your Character Teach Biology for students (Yes/No) :",
"Is Your Character a Class teacher of Any class (Yes/No) :",
"Does your Character teach English for students (Yes/No) :",
"Is your character a coordinator (Yes/No) : " ,
"Is your character a female (Yes/No) : " ,
"Does Your Character work in 'Image Minds' Labs (Yes/No) : " ,
"Does Your Character teach Basketball to students (Yes/No) :" ,
"Does your Character teach football to students (Yes/No) :"]
questions_list2 = [
"Does Your Character teach for Class 11 / 12 (Yes/No): ",
"Does your character teach Maths for students(Yes/No): ",
"Does your character involve in sports with students (Yes/No) : ",
"Does your Character teach Chemistry for students (Yes/No) :",
"Does your Character teach Physics for students (Yes/No) :",
17
"Does your character teach for Class 11 / 12 Arts (Yes/No) :",
"Does your character teach physical education(PT) (Yes/No) :",
"Does your Character Teach Biology for students (Yes/No) :",
"Is Your Character a Class teacher of Any class (Yes/No) :",
"Does your Character teach English for students (Yes/No) :",
"Is your character a coordinator (Yes/No) : ",
"Is your character a female (Yes/No) : ",
"Does Your Character work in 'Image Minds' Labs (Yes/No) : ",
"Does Your Character teach Basketball to students (Yes/No) :",
"Does your Character teach football to students (Yes/No) :"]
keys = ["Class12/11" , "SubMaths", "Sports", "SubChem","SubPhy", "Arts" ,
"PhyEdu","SubBio" , "ClassTeach" , "English" , "Coord" , "Female" , "ImgMinds" ,
"Basketball", "Football"]
(ask_questions(questions_list, questions_list2, keys))
18
OUTPUT
Hello ! This Program is about Guessing character(Teachers) in SVM , I tried adding all of
them but time didn't allow me to input huge data into this project .
In this program , I will be asking few questions about staffs who work in Shri Vidhya
Mandhir and try guessing the character
For YES as your answer enter either 'yes' or 'y'
For No as your answer enter 'no' or 'n'
Enter whether the staff teach classes(YES / NO) : yes
Is Your Character a Class teacher of Any class (Yes/No) : : no
Does your Character teach Chemistry for students (Yes/No) : : no
Does your character teach physical education(PT) (Yes/No) : : no
Does your Character Teach Biology for students (Yes/No) : : no
Does your Character teach English for students (Yes/No) : : no
Does your character teach for Class 11 / 12 Arts (Yes/No) : : no
Does your Character teach Physics for students (Yes/No) : : no
19