The string and the list are finished,
I tried to write a very simple card management system,
New Meng Try,
Don't spray the big boys,
Modify the function of a business card I stole a lazy,
Because I don't know how to define the subscript and then use the subscript to modify the string in the list.
My idea is that the user ready to modify the business card to delete, and then the user new name of the business card can be added;
If there is a way for the big guy to change directly, please give me a hint ...
The code is as follows:
1Name = []2 whileTrue:3 Print("="*50)4 Print("Welcome to the card management system V1.0")5 Print("1: Add a business card")6 Print("2: Modify a business card")7 Print("3: Delete a business card")8 Print("4: Query a business card")9 Print("5: Exit")Ten Print("="*50) Oneadmin = Int (input ("Please enter the function number:")) A - ifadmin = = 1: - whileTrue: theNew_name = input ("Please enter your name:") - ifNew_name = ="return": - Break - name.append (new_name) + Print("=======> added successfully! ") - Print("=======> has now been added with the name:%s"%(name)) + Print("=======> return Menu Please enter: Return") A elifadmin = = 2: at whileTrue: -Al_name = input ("Please enter the name you want to change:") - ifAl_name = ="return": - Break - ifAl_nameinchName: -Als_name = input ("Please enter a new name:") in Name.remove (al_name) - name.append (als_name) to Print("=======> 's current name is:%s"%(name)) + Else: - Print("The name you entered does not exist, please re-enter! ") the Print("=======> return Menu Please enter: Return") * elifadmin = = 3: $ whileTrue:Panax NotoginsengDel_name = input ("Please enter the name you want to delete:") - ifDel_name = ="return": the Break + Name.remove (del_name) A Print("=======> Delete Success! ") the Print("=======> currently has the remaining name:%s"%(name)) + Print("=======> return Menu Please enter: Return") - elifadmin = = 4: $ whileTrue: $Look_name = input ("Please enter the name you want to query:") - ifLook_name = ="return": - Break the Else: - ifLook_nameinchName:Wuyi Print("the name you want to query exists! ") the Else: - Print("no such person! ") Wu Print("=======> return Menu Please enter: Return") - elifadmin = = 5: About Break $ Else: - Print("your input is wrong, please enter it again! ")
Python: Business Card management System