-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckio_password.py
More file actions
36 lines (32 loc) · 1.02 KB
/
checkio_password.py
File metadata and controls
36 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def checkio(data: str) -> bool:
if len(data) < 10:
return False
if not data.isalnum():
return False
x = 0
for i in data:
if i.isdigit():
x = 1
y = 0
for i in data:
if 97 <= ord(i) <= 122:
y = 1
z = 0
for i in data:
if 65 <= ord(i) <= 90:
z = 1
if x == 1 and y == 1 and z == 1:
return True
else:
return False
# Some hints
# Just check all conditions
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio('A1213pokl') == False, "1st example"
assert checkio('bAse730onE4') == True, "2nd example"
assert checkio('asasasasasasasaas') == False, "3rd example"
assert checkio('QWERTYqwerty') == False, "4th example"
assert checkio('123456123456') == False, "5th example"
assert checkio('QwErTy911poqqqq') == True, "6th example"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")