A simple Python business card management system

  • 2020-12-18 01:50:15
  • OfStack

After learning string and list, I tried to write a very simple Python business card management system.

Try something new, and don't spray it.

I'm a bit lazy about modifying the business card function because I don't know how to modify the string in the list by defining the subscript and then modifying the subscript.

My idea is to delete the business card the user is going to modify, and then add the user's newly named business card;

If you have a way to modify directly, please give me some advice.

The code is as follows:


name = []
while True:
 print("="*50)
 print("  Welcome to the card management system V1.0")
 print("1 Add: 1 A business card ")
 print("2 : modify 1 A business card ")
 print("3 : delete 1 A business card ")
 print("4 Query: 1 A business card ")
 print("5 : quit ")
 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 added so far are: %s"%(name))
  print("=======> Return menu please enter: Return ")
 elif admin == 2:
 while True:
  al_name = input(" Please enter the name you want to change: ")
  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("=======> Current names are: %s" % (name))
  else:
  print(" The name you entered does not exist, please re-enter! ")
  print("=======> Return menu 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 successful! ")
  print("=======> The remaining names are: %s" % (name))
  print("=======> Return 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(" There is no such person! ")
  print("=======> Return menu please enter: Return ")
 elif admin == 5:
 break
 else:
 print(" Your input is wrong, please re-input! ")

For more information, please pay attention to the topic management System Development.


Related articles: