PythonでHousePassword
コード3
def checkio(psswd): if (len(psswd) >= 10) and (not psswd.islower()) and (not psswd.isupper()) and (not psswd.isalpha()) and (not psswd.isdigit()): return True #処理時間:0.125s
コード2
def checkio(psswd): return ( (len(psswd) >= 10) and (not psswd.islower()) and (not psswd.isupper()) and (not psswd.isalpha()) and (not psswd.isdigit())) # 処理時間:0.11s # Auther SuperDave1342 # http://www.checkio.org/mission/house-password/publications/SuperDave1342/python-27/strong-password/
コード1
def checkio(data): if 10 <= len(data) <= 64: check = ["1"] for i in list(data): if i.isdigit(): check.append("2") if i.islower(): check.append("3") if i.isupper(): check.append("4") if "".join(sorted(set(check))) == "1234": return True else: return False else: return False checkio('B18daf') #== False checkio('1111GGGGggg')# == True checkio('aeaegagawegaeawaga')# == False checkio('ABCDabcd')# == False checkio('1234567899999')# == False checkio('ZeYEd15qqqqqq')# == True # 処理時間:0.9s
参考にしたサイト
- 「python 文字列処理」URL:「[Python] 文字列処理メソッドまとめ (置換, 文字列を含むかの判定, リストへの変換, etc.) | Memo on the Web」
- 「python 重複 リスト」URL:「Python Tips:リストから重複した要素を削除したい - Life with Python」
- 「python リスト 文字列」URL:「python: リスト <--> 1つの文字列」
- 「python 大文字 判定」 URL:「Pythonの islower() と isupper() の判定処理のワナ - 強火で進め」