Python: Business Card Management System 2.0 (Added login function ),

Source: Internet
Author: User

Python: Business Card Management System 2.0 (Added login function ),

 

In the previous business card management system, the login and registration functions were added ....

New students continue to work ~

Cheer for yourself!

Hahaha ~

Finally, the method of jumping out of the while multi-layer loop is solved...

Before giving the while loop of the outermost layer, set the variable value, such as name = 0

2-layer loops all cycles name = 0

The bounce method is that at the end of the loop, you don't need to use break. Use name = 1 to let the loop go through a layer-by-layer decision.

Under the guidance of our company's old development ............

Don't talk about it. Go to the code ..

Although very simple and simple ....

Limited knowledge, continue to improve.

1 def mingpian (): 2 name = [] 3 name_fl = 0 4 while name_fl = 0: 5 print ("=" * 50) 6 print ("Welcome to business card management system V2.0") 7 print ("1: Add a business card") 8 print ("2: modify a business card") 9 print ("3: delete a business card ") 10 print (" 4: query a business card ") 11 print (" 5: Exit ") 12 print (" = "* 50) 13 admin = int (input ("Enter function No.:") 14 15 if admin = 1: 16 while True: 17 new_name = input ("enter your name: ") 18 if new_name =" return ": 19 break 20 name. append (new_name) 21 print ("======> Added successfully! ") 22 print (" ======> currently added names include: % s "% (name )) 23 print ("======> enter: Return to the return menu") 24 elif admin = 2: 25 while True: 26 al_name = input ("Enter the name you want to modify:") 27 if al_name = "return": 28 break 29 if al_name in name: 30 als_name = input ("enter a new name:") 31 name. remove (al_name) 32 name. append (als_name) 33 print ("======> the current names are: % s" % (name) 34 else: 35 print ("the name you entered does not exist. Please enter it again! ") 36 print (" ======> enter: Return to the return menu ") 37 elif admin = 3: 38 while True: 39 del_name = input ("Enter the name you want to delete:") 40 if del_name = "return": 41 break 42 name. remove (del_name) 43 print ("======> deleted successfully! ") 44 print (" ======> currently, the remaining names are: % s "% (name )) 45 print ("======> enter: Return to the returned menu") 46 elif admin = 4: 47 while True: 48 look_name = input ("Enter the name you want to query:") 49 if look_name = "return": 50 break 51 else: 52 if look_name in name: 53 print ("the name you want to query exists! ") 54 else: 55 print (" No such person found! ") 56 print (" ======> return menu, enter: Return ") 57 elif admin = 5: 58 name_fl = 1 59 else: 60 print ("your input is incorrect. Please input it again! ") 61 62 #===== login registration 63 ad ={} 64 name_fl = 0 65 while name_fl = 0: 66 print (" = "* 50) 67 print ("Welcome to business card management system V2.0") 68 print ("1. log on to ") 69 print (" 2. register ") 70 print (" 3. exit ") 71 print (" = "* 50) 72 73 admin_1 = int (input (" Enter function No.: ") 74 75 if admin_1 = 1: 76 while name_fl = 0: 77 admin = input ("Enter Logon account:") 78 passwd = input ("Enter logon password:") 79 for admins, passwds in ad. items (): 80 if admin = admins and passwd = pas Swds: 81 print ("Logon successful! ") 82 mingpian () 83 name_fl = 1 84 print (" Thank you for using it. Goodbye! ") 85 else: 86 print (" incorrect account or password! Log on again! ") 87 elif admin_1 = 2: 88 while True: 89 new_zh = input (" Enter the registered account: ") 90 if new_zh in ad. keys (): 91 print ("the account already exists! Enter a new one! ") 92 else: 93 new_passwd = input (" Enter the registration password: ") 94 ad [new_zh] = new_passwd 95 print (" registration successful! ") 96 break 97 elif admin_1 = 3: 98 print (" Thank you for using the business card management system V2.0, goodbye! ") 99 else: 100 print (" incorrect input. Please try again! ")

 

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.