Python3.5 simulate multi-Account Login, python3.5 simulate account

Source: Internet
Author: User

Python3.5 simulate multi-Account Login, python3.5 simulate account

Requirements:

1. Multiple accounts

2. Count three times

3. account and password pair-"allow"

4. incorrect account and password. Add the account to the blacklist three times later.

 

 

Ideas:

1. Store account and password information in a dictionary

2. Create a blacklist

3. First, traverse the blacklist and then the account and password to be used.

4. If the account is correct, add the account to the blacklist after three wrong passwords

 

 1 #_*_condinf:utf-8_*_ 2  3  4 user_info={ 5     'zhang':{'password':'123'}, 6     'wang':{'password':'123'}, 7     'li':{'password':'123'}, 8      'zhao':{'password':'123'}, 9      'qian':{'password':'123'},10      'sun':{'password':'123'}11 }12 13 black_info=['aaa','bbb']14 count = 015 count1=016 17 18 while count<3:19     name=input("Please enter the user name:")20     if name in black_info:21         print('please contact administrator!')22         exit()23 24     if not name in user_info :25         print ("The user is not true !")26         count+=127     if name in user_info:28         passwd=input("Please enter password:")29         if passwd == user_info[name]["password"]:30             print ("welcome to you,%s" %name)31             break32         else:33             print('wrong password')34             count+=135 else:36     print('your number will be locked !')

 

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.