After learning strings and lists, I tried to write a very simple Python business card management system myself.
New and cute try, don’t criticize them, big guys.
I was lazy in modifying the business card function because I don’t know how to modify the string in the list by defining the subscript and then using the subscript.
My idea is to delete the business card that the user is preparing to modify, and then add the newly named business card of the user;
If anyone has 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("Please enter the function number: ")) if admin == 1: while True: new_name = input("Please enter your name: ") if new_name = "Return": break name.append(new_name) print("======>Added successfully!") print("========>The names that have been added are: %s"%(name)) print("========>Please enter: return") elif admin == 2: while True: al_name = input("Please enter the name you want to modify:") if al_name == "Return": break if al_name in name: als_name = input("Please 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, please re-enter!") print("=======>Please enter: return") elif admin == 3: while True: del_name = input("Please enter the name you want to delete: ") if del_name == "Return": break name.remove(del_name) print("=======>Delete successfully!") print("=======>The remaining names are: %s" % (name)) print("========>Return to the menu, please enter: return") elif admin == 4: while True: look_name = input("Please 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 one is checked!") print("=======>Return to the menu, please enter: Return") elif admin == 5: break else: print("Your input is wrong, please enter it again!")For more learning materials, please pay attention to the special topic "Management System Development".
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.