A simple Python business card management system,
After learning about strings and lists, I tried to write a very simple Python business card management system.
Try xinmeng. Don't try it.
I am a little lazy about modifying the business card function, because I don't know how to define the subscript and then modify the strings in the list through the subscript.
My idea is to delete the business card that the user is about to modify, and then add the new name to the business card;
If you have a direct modification method, please give me some advice.
The Code is as follows:
Name = [] while True: print ("=" * 50) print ("Welcome to business card management system V1.0") print ("1: Add a business card ") print ("2: modify a business card") print ("3: delete a business card") print ("4: query a business card") print ("5: Exit ") print ("=" * 50) admin = int (input ("Enter function No.:") if admin = 1: while True: new_name = input ("enter your name:") if new_name = "return": break name. append (new_name) print ("======> added successfully! ") Print (" ======> currently added names include: % s "% (name )) print ("======> return menu, enter: Return") elif admin = 2: while True: al_name = input ("Enter the name you want to modify:") if al_name = "return": break if al_name in name: als_name = input ("enter a new name: ") name. remove (al_name) name. append (als_name) print ("======> the current names are: % s" % (name) else: print ("the name you entered does not exist, enter again! ") Print (" ======> enter: Return to the return menu ") elif admin = 3: while True: del_name = input ("Enter the name you want to delete:") if del_name = "return": break name. remove (del_name) print ("======> deleted successfully! ") Print (" ======> currently, the remaining names are: % s "% (name )) print ("======> return menu, enter: Return") elif admin = 4: while True: look_name = input ("Enter the name you want to query:") if look_name = "return": break else: if look_name in name: print ("the name you want to query exists! ") Else: print (" No such person found! ") Print (" ======> enter: Return to the return menu ") elif admin = 5: break else: print (" your input is incorrect, enter a new one! ")
For more information, see management system development.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.