要求:spa
一、多个帐号code
二、三次计数blog
三、帐号密码对--》放行utf-8
四、帐号对密码不对,3次后加入黑名单input
思路:it
一、用字典存放帐号密码信息class
二、创建一个黑名单列表遍历
三、首先遍历黑名单,再遍历要用的帐号密码密码
四、若是帐号对,三次密码错后,加入黑名单word
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 = 0 15 count1=0 16 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+=1 27 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 break 32 else: 33 print('wrong password') 34 count+=1 35 else: 36 print('your number will be locked !')