day_09py Simple name management system

#! /usr/bin/env/python 
#-*-coding:utf-8-*-
'''
The name management system
does program iteration, from point to point.
'''
# 1. Printing function prompt
print( "="*50)
print(" Name Relationship System V1.0")
print(" 1: Add a new name")
print(" 2: Delete a name")
print(" 3: Modify a name")
print (" 4: Query a name")
print(" 5: Exit the system")
print("="*50)

names = [] # Define an empty list to store the added names
while True:
# 2. Get the user The choice of
num = int(input("Please enter the function serial number:"))
# 3. According to the user's choice, execute the corresponding function
if num==1:
new_name = input("Please enter the name:")
names.append( new_name)
print(names)
elif num==2:


if rm_name in names:
names.remove(rm_name)
print("Successfully removed, remaining names: %s"%names)
else:
print("The name was not found")
elif num==3:
pass
elif num==4:
find_name = input("Please enter the name you want to query:")
if find_name in names:
print("Found the person you are looking for:%s"%find_name)
else:
print("Sorry, didn't find it")
elif num= =5:
print("Exit the program")
break
else:
print("Your input is incorrect, please re-enter")

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324655770&siteId=291194637