Python Simple business Card manager __python

Source: Internet
Author: User
Looping through lists (for loops) list common operations ("add", "delete", "" Change "," Check "(append) to delete (" Pop "," del "," Remove ") to change (" first find the user subscript, in the modified, as the list elements assigned to the same ") check (in, don't in)
#coding =utf-8 name=["Zhangsan", "Wangwu", "Test" print ("*" *40) print ("Welcome to Business Card management system") print ("Please follow the prompts.")
        ") Print (" * "*40) #打印列表 def ceshi (): Print (" Content in current business card system ") I=0 for J-in Name:print (" name[%d]=%s "% (i,j)) I+=1 while True: #打印用户提示 print (select the corresponding feature) print (Find user select: 1) Print (Modify User: 2 ") Print (" Delete User select: 3 "Print (Add user select: 4") Print ("Exit application Please choose: 5") a=input ("Please enter your choice:") if A==1:findname=raw_input (
        "Please enter name for query") if FindName in Name:print ("found") else:print ("Not Found") Elif a==2:
            Ceshi () i=input ("Please enter the user number to modify") Temp=raw_input ("Please enter the modified username") if I<len (name): Old=name[i] name[i]= (temp) print (user name%s has been modified to%s% (old,temp)) else:print (' User serial number does not exist
        In ') elif A==3:ceshi () d=input ("Please select Delete action to make") print (delete by subscript: 1) print ("Delete last element: 2") Print (delete according to the value of element: 3) If d==1:
            H=input (' Enter the serial number of the user to be deleted ') del name[h] if H<len (name): print ("delete succeeded")
        Else:print ("This user number does not exist") elif D==2:name.pop () print ("Delete succeeded") Elif d==3:val=input ("Please enter the username to be removed") name.remove ('%s '%val) print ("Delete succeeded") elif A==4:print ("******** before adding user Data ********") Ceshi () temp=raw_input ("Enter the name of the user to add") name.append (t EMP) Print ("******** User Data ********") Ceshi () elif a==5:break else:p Rint ("Input error, please re-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.