python3.5類比多帳號登入,python3.5類比帳號

來源:互聯網
上載者:User

python3.5類比多帳號登入,python3.5類比帳號

要求:

1、多個帳號

2、三次計數

3、帳號密碼對--》允許存取

4、帳號對密碼不對,3次後加入黑名單

 

 

思路:

1、用字典存放帳號密碼資訊

2、建立一個黑名單列表

3、首先遍曆黑名單,再遍曆要用的帳號密碼

4、如果帳號對,三次密碼錯後,加入黑名單

 

 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 !')

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.