0% found this document useful (0 votes)
4 views23 pages

Project File Format

The document is a project file for a Computer Science project titled 'Telephone Directory' created by Avni Saldhi for Class XII at Manipal Public School. It includes sections such as requirements, introduction, source code, output, conclusion, and bibliography, detailing the development of a phone book application using Python. The project aims to provide a user-friendly interface for managing contact information efficiently.

Uploaded by

mpsgpathak921
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views23 pages

Project File Format

The document is a project file for a Computer Science project titled 'Telephone Directory' created by Avni Saldhi for Class XII at Manipal Public School. It includes sections such as requirements, introduction, source code, output, conclusion, and bibliography, detailing the development of a phone book application using Python. The project aims to provide a user-friendly interface for managing contact information efficiently.

Uploaded by

mpsgpathak921
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MANIPAL PUBLIC SCHOOL

OMAXE CITY, LUCKNOW

(SESSION 2024-25)

COMPUTER SCIENCE (083)


CLASS XII
PROJECT FILE
“Telephone Directory”

MADE BY:
NAME OF STUDENT- Avni Saldhi

CLASS & SECTION- XII-A

TABLE OF CONTENTS

SNO CONTENT PAGE NO SIGN


CERTIFICATE 1

1
ACKNOWLEDGEMENT 2

REQUIREMENTS 3

INTRODUCTION 4-5

HEADER FILES USED 6

SOURCE CODE 7-18

OUTPUT 19-20

CONCLUSION 21

BIBLIOGRAPHY 22

MANIPAL PUBLIC SCHOOL

2
OMAXE CITY, LUCKNOW
This is to certify that Avni Saldhi of class XII-A has completed Computer Science Project on the

topic “Telephone Directory” as per CBSE guidelines.

Signature Signature

Ms. Smita Singh Mr. Gaurav Pathak

Principal TGT Computer Science

Manipal Public School, Omaxe city, Lucknow. Manipal Public School, Omaxe city,
Lucknow.

Date………………………..

ACKNOWLEDGEMENT

This project is prepared under the kind guidance of my teacher, Mr.


Gaurav Pathak. I am deeply indebted and thankful to him for
showing me a pathway for a successful Computer Project. I am
also thankful to my school for providing me most of the facilities

3
while doing my project. Lastly, I am grateful to my parents and
friends who have provided help and encouragement at every step.

AVNI SALDHI

(NAME OF STUDENT)

REQUIREMENTS
Minimum requirements are:
 Basic knowledge of computer.
 Basic knowledge about Python.
 Knowledge about File Handling

Minimum hardware requirements are:

4
 Windows 10 installed computer or laptop.

Minimum software requirements:


 Python 3x
 Text Files
 CSV Files
 Python Libraries and Modules
 GPRS System in Mobile handset

INTRODUCTION
Phone Book system is a small web application developed for project. In older days we
stored all our important contact details in books and papers. Here we proposed a new
system using this application so that we can store all the details in a central repository.
In manual method if we forget information book then it will be very difficult to get the
contact details. By using this application, we can see our contacts anywhere in the
world. In this project we will save our contacts, address and we can search them by
name and also we can see all of them at the same [Link] system is developed
using the general required by the user while using the phone directory book. In order to
keep the directory updated, the admin will have the authority to add and delete as well
as modify the existing records within the phone book directory. The user will only have
the authority to search any particular and listing details of all available records.

5
AIMS AND OBJECTIVES
Aims
The main aim of this project is to create a directory that is able to provide the ability to
search, view, and manage entries in a directory about various individuals.

Objectives
The objective of this Python project is to keep the contact information for specific
individuals in a database. It is a friendly easy to use interface developed as the
backend to store the details such as names, phone numbers, email addresses, etc.
This system is developed to reduce the errors that creep up in the manual systems.

APPLICATION AND BENEFITS


Applications
 It is a secure system to store Confidential as well as public details and can be
accessed easily by anyone in any corner of the world.
 This application helps reducing the manual work of adding, deleting and
modifying data, decreasing chances of errors and gives a better presented
records.
 Users can manage their records easily reducing workload and stress.

Benefits
 As it is based on object-orientated design, any further changes can be easily
adaptable.
 This system helps the people to be free from the task of remembering the details
of each and every individual.
 It is reliable and accurate resource to access your data and based on future
security issues security can be improved using emerging technologies.

6
HEADER FILES USED
Python allows the use of modules and libraries including CSV libraries to create such a
system in an efficient way. Therefore, we have used 2D list concept and file handling to
implement the same in Python3. There are a total of 8 functions used in this code,
namely:

 Initial phone book() : The first function to run, it initializes the phonebook.
 menu() : It displays the choices available to the user and returns the choice
entered.
 add_contact() : It adds a new contact to the Contacts directory.
 remove_existing() : It removes an existing contact from the Contacts directory.
 delete_all() : It deletes all the contacts from the Contacts directory.
 display_all() : It displays all the contacts from the Contacts directory.
 search_existing() : It will search and display an existing contact in the Contacts
directory.
 thanks()

7
SOURCE CODE
# importing the module

import sys

# this function will be the first to run as soon as the main function executes

def initial_phonebook():

rows, cols = int(input("Please enter initial number of contacts: ")), 5

# We are collecting the initial number of contacts the user wants to have in the

# phonebook already. User may also enter 0 if he doesn't wish to enter any.

phone_book = []

print(phone_book)

for i in range(rows):

print("\nEnter contact %d details in the following order (ONLY):" % (i+1))

print("NOTE: * indicates mandatory fields")

print("....................................................................")

8
temp = []

for j in range(cols):

# We have taken the conditions for values of j only for the personalized
fields

# such as name, number, e-mail id, dob, category etc

if j == 0:

[Link](str(input("Enter name*: ")))

# We need to check if the user has left the name empty as its
mentioned that

# name & number are mandatory fields.

# So implement a condition to check as below.

if temp[j] == '' or temp[j] == ' ':

[Link](

"Name is a mandatory field. Process exiting due to


blank field...")

# This will exit the process if a blank field is encountered.

if j == 1:

[Link](int(input("Enter number*: ")))

# We do not need to check if user has entered the number


because int automatically

# takes care of it. Int value cannot accept a blank as that counts
as a string.

# So process automatically exits without us using the sys


package.

9
if j == 2:

[Link](str(input("Enter e-mail address: ")))

# Even if this field is left as blank, None will take the blank's
place

if temp[j] == '' or temp[j] == ' ':

temp[j] = None

if j == 3:

[Link](str(input("Enter date of birth(dd/mm/yy): ")))

# Whatever format the user enters dob in, it won't make a


difference to the compiler

# Only while searching the user will have to enter query exactly
the same way as

# he entered during the input so as to ensure accurate


searches

if temp[j] == '' or temp[j] == ' ':

# Even if this field is left as blank, None will take the blank's
place

temp[j] = None

if j == 4:

[Link](

str(input("Enter category(Family/Friends/Work/Others):
")))

# Even if this field is left as blank, None will take the blank's
place

10
if temp[j] == "" or temp[j] == ' ':

temp[j] = None

phone_book.append(temp)

# By this step we are appending a list temp into a list phone_book

# That means phone_book is a 2-D array and temp is a 1-D array

print(phone_book)

return phone_book

def menu():

# We created this simple menu function for

# code reusability & also for an interactive console

# Menu func will only execute when called

print("************************")

print("\t\t\tSMARTPHONE DIRECTORY", flush=False)

print("************************")

print("\tYou can now perform the following operations on this phonebook\n")

print("1. Add a new contact")

print("2. Remove an existing contact")

print("3. Delete all contacts")

print("4. Search for a contact")

print("5. Display all contacts")

print("6. Exit phonebook")

11
# Out of the provided 6 choices, user needs to enter any 1 choice among the 6

# We return the entered choice to the calling function wiz main in our case

choice = int(input("Please enter your choice: "))

return choice

def add_contact(pb):

# Adding a contact is the easiest because all you need to do is:

# append another list of details into the already existing list

dip = []

for i in range(len(pb[0])):

if i == 0:

[Link](str(input("Enter name: ")))

if i == 1:

[Link](int(input("Enter number: ")))

if i == 2:

[Link](str(input("Enter e-mail address: ")))

if i == 3:

[Link](str(input("Enter date of birth(dd/mm/yy): ")))

if i == 4:

[Link](

str(input("Enter category(Family/Friends/Work/Others): ")))

[Link](dip)

# And once you modify the list, you return it to the calling function wiz main, here.

return pb

12
def remove_existing(pb):

# This function is to remove a contact's details from existing phonebook

query = str(

input("Please enter the name of the contact you wish to remove: "))

# We'll collect name of the contact and search if it exists in our phonebook

temp = 0

# temp is a checking variable here. We assigned a value 0 to temp.

for i in range(len(pb)):

if query == pb[i][0]:

temp += 1

# Temp will be incremented & it won't be 0 anymore in this function's


scope

print([Link](i))

# The pop function removes entry at index i

print("This query has now been removed")

# printing a confirmation message after removal.

# This ensures that removal was successful.

# After removal we will return the modified phonebook to the calling


function

# which is main in our program

13
return pb

if temp == 0:

# Now if at all any case matches temp should've incremented but if


otherwise,

# temp will remain 0 and that means the query does not exist in this
phonebook

print("Sorry, you have entered an invalid query.\

Please recheck and try again later.")

return pb

def delete_all(pb):

# This function will simply delete all the entries in the phonebook pb

# It will return an empty phonebook after clearing

return [Link]()

def search_existing(pb):

# This function searches for an existing contact and displays the result

choice = int(input("Enter search criteria\n\n\

1. Name\n2. Number\n3. Email-id\n4. DOB\n5.


Category(Family/Friends/Work/Others)\

\nPlease enter: "))

# We're doing so just to ensure that the user experiences a customized search
result

temp = []

14
check = -1

if choice == 1:

# This will execute for searches based on contact name

query = str(

input("Please enter the name of the contact you wish to search: "))

for i in range(len(pb)):

if query == pb[i][0]:

check = i

[Link](pb[i])

elif choice == 2:

# This will execute for searches based on contact number

query = int(

input("Please enter the number of the contact you wish to search: "))

for i in range(len(pb)):

if query == pb[i][1]:

check = i

[Link](pb[i])

elif choice == 3:

# This will execute for searches based on contact's e-mail address

query = str(input("Please enter the e-mail ID\

of the contact you wish to search: "))

for i in range(len(pb)):

15
if query == pb[i][2]:

check = i

[Link](pb[i])

elif choice == 4:

# This will execute for searches based on contact''s date of birth

query = str(input("Please enter the DOB (in dd/mm/yyyy format ONLY)\

of the contact you wish to search: "))

for i in range(len(pb)):

if query == pb[i][3]:

check = i

[Link](pb[i])

elif choice == 5:

# This will execute for searches based on contact category

query = str(

input("Please enter the category of the contact you wish to search: "))

for i in range(len(pb)):

if query == pb[i][4]:

check = i

[Link](pb[i])

# All contacts under query category will be shown using this feature

else:

# If the user enters any other choice then the search will be unsuccessful

16
print("Invalid search criteria")

return -1

# returning -1 indicates that the search was unsuccessful

# all the searches are stored in temp and all the results will be displayed with

# the help of display function

if check == -1:

return -1

# returning -1 indicates that the query did not exist in the directory

else:

display_all(temp)

return check

# we're just returning a index value wiz not -1 to calling function just to
notify

# that the search worked successfully

# this function displays all content of phonebook pb

def display_all(pb):

if not pb:

# if display function is called after deleting all contacts then the len will be 0

# And then without this condition it will throw an error

print("List is empty: []")

else:

for i in range(len(pb)):

17
print(pb[i])

def thanks():

# A simple gesture of courtesy towards the user to enhance user experience

print("************************")

print("Thank you for using our Smartphone directory system.")

print("Please visit again!")

print("************************")

[Link]("Goodbye, have a nice day ahead!")

# Main function code

print("....................................................................")

print("Hello dear user, welcome to our smartphone directory system")

print("You may now proceed to explore this directory")

print("....................................................................")

# This is solely meant for decoration purpose only.

# You're free to modify your interface as per your will to make it look interactive

ch = 1

pb = initial_phonebook()

while ch in (1, 2, 3, 4, 5):

ch = menu()

if ch == 1:

pb = add_contact(pb)

elif ch == 2:

18
pb = remove_existing(pb)

elif ch == 3:

pb = delete_all(pb)

elif ch == 4:

d = search_existing(pb)

if d == -1:

print("The contact does not exist. Please try again")

elif ch == 5:

display_all(pb)

else:

thanks()

19
OUTPUT/ SCREEN SHOTS

__________________________________________________________________________________________

_________________________________________________________________________________________

20
__________________________________________________________________________________________

__________________________________________________________________________________________

__________________________________________________________________________________________

21
__________________________________________________________________________________________

__________________________________________________________________________________________

CONCLUSION
This application software is user friendly, and has required options, which can be

utilized by the use to perform the desired operations. The goals that are achieved by
the software are:

 Optimum utilization of resources.


 Efficient management of records.
 Simplification of the operations.
 Less processing time and getting required information.
 User friendly.
 Portable and flexible for further enhancements

22
BIBLIOGRAPHY

References have been taken from the following sources

 Computer Sciences with Python (XII)- Sumota Arora


 Geeks for [Link]

23

You might also like