To run the program, enter the following command in a Terminal/Command LineĮ-mail Address: Contact created successfully. The code is big because of the different operations we can perform but it is quite simple and intuitive. We have created a menu with 6 options and we have methods in our class to perform each of these operations (except exit). #- Search Contact -# def search (self, number=False, name=False): if name:Ĭhoice = int(input( '\nEnter your Choice: ' )) Print( '\nTotal Contacts found: ', len(self.book)) Print( '\nNumber Entries: ', self.numbers)Ĭ, 'number: ', self.numbers, 'details: ', self.book, '\n' ) 'Are you sure want to DELETE.? (y/n): ' ).lower() Input( 'Enter index of listed CONTACT above: ' )) #- DELETE Contacts -# def delete (self, name=False, number=False): if name:Ĭ, 'name: ', self.names, 'details: ', self.book, '\n' ) Inp = input( "Press 'y' to continue or exit to 'n': " ) Step2: Simply, double click the AddressBook.py file and you are ready to go. Print( 'No.of contacts found: ', len(inumbers))Ĭ, 'Number: ', self.numbers, 'details: ', self.book, '\n' ) Step2: Go inside the project folder, open cmd then type AddressBook.py and enter to start the system. In the init method (the constructor of the class), you can initialize those attributes, then print them in a separate method showInfo. Print( 3, '- Email: ', self.book)Ĭh_name = input( 'Enter name to update: ' )Ĭh_email = input( 'Enter Email to update: ' ) What you need is a Contact class, which will contain attributes such as name and mobileNo. Input( 'Enter index of listed contact above: ' )) "Press 'y' to continue or exit to 'n': " ).lower() Print( 'No.of contacts found: ', len(inames), inames) Print(name, 'Contact created successfully.!' )ĭef update (self, name=False, number=False): # - Update Using Names -# if name: Save the below code in a file named 'contact.py'. Wine Quality with Python & Machine Learning Build a Contact Book With Python, PyQt. Our class will contain different methods for different processes we will use.Īt the end we will create a Command Line Interface for different operations to perform in the contact book. 70+ Simple, Advanced And Best Python Projects With Source Code for. We will use two lists so that we can search by name and phone number both. For this we will create a class containing our contacts as lists. If entry_to_delete in ():įor name, number in this article, we will make a contact book. py using python launcher DOWNLOAD Contact Book Application In Python With Source Code FOR FREE Contact Book Application In Python With Source Code 1 file (s) 0. Print(search, " : ", self.phonebook)Įntry_to_delete = input("ENTER NAME OF ENTRY TO DELETE: ") Installation Steps: Download and Extract the. Search = input("ENTER NAME TO SEARCH FOR: ") #Prompt the user for the name to search for, and search the phonebook dictionary #Print out the entire phonebook dictionaryįor name, number in (): #Create a string to be written to the file #Prompt the user for the details of the new entry Contact details are saved in mysql database. Some of the features in this project to delete contacts, update contact information, and display saved contacts. With this Contact Book project, you can save and find contact details. #Load all of the items from the text file into the dictionary A contact book is a tool for saving a contact’s details, such as name, address, phone number, and email address. It only seems to run in idle though - when I run the actual python file - the menu doesn't work. I'd be grateful if y'all could give me some tips and ways to improve on it/make it more efficient :) So to refresh my memory and have a bit of a practice I wrote a quick phone-book program. I got bored of revision last night, and decided to have another go at python!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |