0% found this document useful (0 votes)
8 views

Developing a Phonebook Using Python

Uploaded by

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

Developing a Phonebook Using Python

Uploaded by

SATYA SAI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

AUGUMENTED EXPERIMENT

PHONEBOOK
USING PYTHON

Submitted by :
Name : S.Satya Sai

Section : N

Roll no : 16

JNTU no : 21341A03C3

Branch : Mechanical
DEVELOPING A PHONEBOOK USING PYTHON

ABSTRACT :
This augument experiment to implement a smartphone directory that collects contact data
from the user until the user prompts the program to. Contact data refers to the contact’s
name, phone number, date-of-birth, a category that contact belongs to (Friends, Family,
Work, Other), e-mail address. The user may enter as much data as he can in the mentioned
data labels. If some labels remain void of data, store it as None. A name & the number is
mandatory to create contact. Implement the following operations on the directory: Insert,
Delete, Search, Display.

INTRODUCTION OF THE PROJECT/ALGORITHM IN DETAIL :


The key should still be simply the persons name. Adapt the menu used in the example
accordingly, for example the '2. Add a Phone Number' should now read '2. Add an entry' and
if selected should ask the user for the 4 items of information (name, phone, email, web).
Aditionally: Add an option (e.g. number 6 in the menu) to 'Change/Edit an existing entry.

OPERATIONS :
1) Adding contacts to phonebook
2) Searching contacts in phonebook
3) Display all the contacts in the phonebook
4) Editing the contacts
5) Deleting contacts in the phonebook

CONCEPTS USED :
1) Dictionary
2) While loop
3) For loop
4) Conditional statement
5) Calling a function
6) Membership operators
PROGRAM CODE :

contact = {}
def display_contact():
print("name\t\tcontact number")
for key in contact:
print("{}\t\t{}".format(key,contact.get(key)))

while True:
choice = int(input("\n 1. ADD NEW CONTACT \n 2. SEARCH CONTACT \n 3.
DISPLAY CONTACT \n 4. EDIT CONTACT \n 5. DELETE CONTACT \n 6. EXIT \n\n
ENTER YOUR CHOICE:"))
if choice == 1:
name = input("\nEnter the contact name:")
phone = input("Enter the phone number:")
contact[name] = phone
elif choice == 2:
search_name = input("Enter the contact name:")
if search_name in contact:
print(search_name,"contact number is ",contact[search_name])
else:
print("Name is not found")
elif choice == 3:
if not contact:
print("Empty contact book")
else:
display_contact()
elif choice == 4:
edit_contact = input("Enter the contact name to edit:")
if edit_contact in contact:
phone = input("Enter phone number:")
contact[edit_contact]=phone
print("Contact updated")
display_contact()
else:
print("Name is not found")

elif choice == 5:
del_contact = input("Enter the contact name to delete:")
if del_contact in contact:
confirm = input("Do you want to delete this contact yes/no?")
if confirm =='yes' or confirm == 'YES':

contact.pop(del_contact)
display_contact()
else:
print("Name is not found")
else:

break
OUTPUT 1 :
OUTPUT 2 :

You might also like