A contact book is a database used to store entries related to a person’s contacts like a phone number, email address, etc. It is also known as the address book. In this article, I’ll walk you through how to create a contact book with Python.
Create a Contact Book using Python
Creating a contact book is a great project for someone who is at an intermediate level in Python. Somehow this follows the use of data structures and algorithms as we are going to add contacts to the book and find them using the person’s name.
Also, Read – 100+ Machine Learning Projects Solved and Explained.
So, creating a contacts book in Python will help you show and improve your coding skills a lot. When creating a contacts book with Python, you need to design an algorithm that allows the user to record and find any person’s details.
Contact Book with Python
In this section, I will walk you through how to create a basic contacts book with the Python programming language to store and find contacts. With a few modifications, you can use it as a project where you can implement the same algorithm on a database like MySQL to store the contacts.
Now let’s see how to design an algorithm to create a contact book with Python. Note that you can save more information other than just contact details by customizing the code below:
Name: Aman Phone Number: 8587****** Name: Akash Phone Number: 9810****** Name: Kharwal Phone Number: 9811****** Name Phone Number Aman 8587****** Akash 9810****** Kharwal 9811****** Enter search term: Aman Search result: Name: Aman, Phone Number: 8587******
While running the above code, you need to add 3 contacts and then you will be asked to search for a contact. Remember to use the person’s name as your search term and feel free to change the code to suit your needs.
I hope you liked this article on how to create a contacts book with Python. Feel free to ask your valuable questions in the comments section below.
Love this code, really useful. Only tweak I made was changing
num = 3 to num= int(input(“How many people’s data are you storing?: “))