Use Python to complete a simple name management system

Source: Internet
Author: User

use Python to complete a simple name management system



#1. Print Feature tip print ("=" *30) print ("-" *5+ "Name Relational system" + "-*5) print (" 1. Add a new name: ") Print (" 2. Delete a name: ") Print (" 3. Modify a Name: ") print ("4. Query a name:") Print ("5. Query all:") print ("6. Exit system") print ("=" *30) names=[] #定义一个空的列表用来存储添加的名字 while True: #2. Get the user's Choice num =int (Input ("Enter function serial number:") #3. According to the user's choice, perform the corresponding function if Num==1:new_name=input ("Please enter first Name:") names.append (new_name) p
     Rint (names) elif num==2:del_name=input ("Please enter the name to be deleted:") if Del_name in Names:names.remove (del_name) Else:print ("Cannot delete, the name to be deleted does not exist ...")
        ") elif num==3:edit_name=input (" Please enter the name to be modified: ") if Edit_name in Names:edit_name1=input (" Please enter first Name: ") Names[names.index (edit_name)]=edit_name1 else:print ("cannot be modified, the name does not exist ...
        Elif num==4:find_name=input ("Please enter the name to query:") if Find_name in Names:print ("Find the person you are looking for") Else: Print ("No this person ... ") Elif Num==5:print (names) elif Num==6:print (" Successfully exited system ... ") Break Else:print (" Your input is incorrect, pleaseRe-enter ...
 ")


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.