house_password.checkio()   A
last analyzed

Complexity

Conditions 5

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 9
nop 1
dl 0
loc 11
rs 9.3333
c 0
b 0
f 0
1
def checkio(data):
2
    has_numbers = {str(i) for i in range(0, 10)}.intersection(set(data))
3
    has_lower_chars = {chr(i) for i in range(ord('a'), ord('z') + 1)}.intersection(
4
        set(data)
5
    )
6
    has_upper_chars = {chr(i) for i in range(ord('A'), ord('Z') + 1)}.intersection(
7
        set(data)
8
    )
9
    if len(data) >= 10 and has_numbers and has_lower_chars and has_upper_chars:
10
        return True
11
    return False
12
13
14
if __name__ == '__main__':  # pragma: no cover
15
    # These "asserts" using only for self-checking and not necessary for
16
    # auto-testing
17
    assert checkio('A1213pokl') is False, "1st example"
18
    assert checkio('bAse730onE4') is True, "2nd example"
19
    assert checkio('asasasasasasasaas') is False, "3rd example"
20
    assert checkio('QWERTYqwerty') is False, "4th example"
21
    assert checkio('123456123456') is False, "5th example"
22
    assert checkio('QwErTy911poqqqq') is True, "6th example"
23