Skip to content

Commit 151987e

Browse files
committed
By Zhao Kun Peng
1 parent f36f2fd commit 151987e

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

checkio/checkio_password.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
def checkio(data: str) -> bool:
2+
if len(data) < 10:
3+
return False
4+
if not data.isalnum():
5+
return False
6+
x = 0
7+
for i in data:
8+
if i.isdigit():
9+
x = 1
10+
y = 0
11+
for i in data:
12+
if 97 <= ord(i) <= 122:
13+
y = 1
14+
z = 0
15+
for i in data:
16+
if 65 <= ord(i) <= 90:
17+
z = 1
18+
if x == 1 and y == 1 and z == 1:
19+
return True
20+
else:
21+
return False
22+
23+
24+
# Some hints
25+
# Just check all conditions
26+
27+
28+
if __name__ == '__main__':
29+
# These "asserts" using only for self-checking and not necessary for auto-testing
30+
assert checkio('A1213pokl') == False, "1st example"
31+
assert checkio('bAse730onE4') == True, "2nd example"
32+
assert checkio('asasasasasasasaas') == False, "3rd example"
33+
assert checkio('QWERTYqwerty') == False, "4th example"
34+
assert checkio('123456123456') == False, "5th example"
35+
assert checkio('QwErTy911poqqqq') == True, "6th example"
36+
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")

0 commit comments

Comments
 (0)