哪里错了 大佬求带

B3843 [GESP202306 三级] 密码合规

zzhcn @ 2024-09-24 16:21:09

a = input() a1 = a.split(',') print(a1) n = 0 for i in a1: if 6 < len(i) < 12: if '$' in i or '!' in i or '@' in i or '#' in i: for j in i: if int(ord('a')) < int(ord(j)) < int(ord('z')): n += 1 elif int(ord('A')) < int(ord(j)) < int(ord('Z')): n += 1 elif int(ord('0')) < int(ord(j)) < int(ord('9')): n += 1 if n > 2: print(i) continue else: continue

__


by _chicken_ @ 2024-09-24 16:24:56

@zzhcn

希望更丰富的展现?使用 Markdown、KaTeX。


by Kagami_sama @ 2024-09-26 18:00:58

改好了,自个看

a = input()
a1 = a.split(',')
for i in a1:
    st = [0, 0, 0]
    is1 = False
    is2 = True
    if 6 <= len(i) <= 12:
        for j in i:
            if int(ord('a')) < int(ord(j)) < int(ord('z')):
                st[0] = 1
            elif int(ord('A')) < int(ord(j)) < int(ord('Z')):
                st[1] = 1
            elif int(ord('0')) < int(ord(j)) < int(ord('9')):
                st[2] = 1
            elif j in '!@#$':
                is1 = True
            else:
                is2 = False
    if sum(st) > 1 and is1 and is2:
        print(i)

by Kagami_sama @ 2024-09-27 09:27:30

@zzhcn

string = input()
passwds = string.split(',')

a = ord('a')
z = ord('z')
A = ord('A')
Z = ord('Z')
num0 = ord('0')
num9 = ord('9')

for passwd in passwds:
    st = [0, 0, 0]
    is1 = False
    is2 = True
    if 6 <= len(passwd) <= 12:
        for item in passwd:
            ASCII = ord(item)
            if a <= ASCII <= z:
                st[0] = 1
            elif A <= ASCII <= Z:
                st[1] = 1
            elif num0 <= ASCII <= num9:
                st[2] = 1
            elif item in '!@#$':
                is1 = True
            else:
                is2 = False
    if sum(st) > 1 and is1 and is2:
        print(passwd)

|