02_python闖關練習_01Password
阿新 • • 發佈:2018-01-06
please true () eas auth def symbol strong tro
判斷密碼是否:
1. 長度大於10;
2. 包含數字;
3. 包含大寫字母;
4. 包含小寫字母。
1 # Author:Zhang Yide 2 # coding:utf-8 3 4 def password(data): 5 ‘‘‘Check if password inputed is strong enough 6 7 Its length is greater than or equal to 10 symbols; 8 It has at least one digit; 9 It has at least one uppercase letter and lowercase letter‘‘‘ 10 11 data = str(data) 12 HasDigit = any(i.isdigit() for i in data) 13 HasUpper = any(i.isupper() for i in data) 14 HasLower = any(i.islower() for i in data) 15 if HasDigit and HasUpper and HasLower and len(data) >= 10: 16 return True 17 else: 18 return False19 20 while True: 21 data = input("please input password:\n") 22 print(password(data))
02_python闖關練習_01Password