-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathstrong-password.py
More file actions
44 lines (30 loc) · 853 Bytes
/
strong-password.py
File metadata and controls
44 lines (30 loc) · 853 Bytes
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
37
38
39
40
41
42
43
44
#!/bin/python3
import math
import os
import random
import re
import sys
numbers = "0123456789"
lower_case = "abcdefghijklmnopqrstuvwxyz"
upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters = "!@#$%^&*()-+"
def minimumNumber(n, password):
res = 0
if not any(x in numbers for x in password):
res += 1
if not any(x in lower_case for x in password):
res += 1
if not any(x in upper_case for x in password):
res += 1
if not any(x in special_characters for x in password):
res += 1
if len(password) < 6:
return max(res, 6 - len(password))
return res
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
password = input()
answer = minimumNumber(n, password)
fptr.write(str(answer) + '\n')
fptr.close()