今年更新后的题目改错了:
条件1应该是密码长度不小于8;
否则一直提交不成功
def f1(s):
if len(s) >= 8:
return True
return False
def f2(s):
up = 0
lw = 0
num = 0
ot = 0
for i in s:
if i.isupper():
up += 1
elif i.islower():
lw += 1
elif i.isdigit():
num += 1
else:
ot += 1
if (up != 0 and lw != 0 and num != 0 and ot != 0) or (up == 0 and lw != 0 and num != 0 and ot != 0) or (up != 0 and lw == 0 and num != 0 and ot != 0) or (up != 0 and lw != 0 and num == 0 and ot != 0) or (up != 0 and lw != 0 and num != 0 and ot == 0):
return True
return False
def f3(s):
for i in range(len(s)):
if s[i:i+3] in s[i+3:]:
return False
return True
while True:
try:
s = input()
#print(f1(s))
#print(f2(s))
#print(f3(s))
if f1(s) and f2(s) and f3(s):
print('OK')
else:
print('NG')
except:
break