【发布时间】:2014-11-10 22:55:10
【问题描述】:
我花了几个小时解决了这个问题,但程序不起作用(语法错误)。 检查类似问题的答案没有帮助。下面的代码有什么问题? 我想检查列表(密码)是否包含至少一个数字,以及其中包含一个大写字母和一个小写字母。 请给我最简单的方法,我是初学者...
def checkio(password):
array = list(password)
#for letter in array:
if len(array) < 10 or len(array) > 64:
return False
if (any(l.isdigit() for l in array) and (any(l.isupper( for l in array) and (any(l.islower for l in array):
return True
else:
return False
【问题讨论】:
-
你想要 if: else if: else ?试试看。
标签: python list element contain