File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/bin/python3
2
+
3
+ import math
4
+ import os
5
+ import random
6
+ import re
7
+ import sys
8
+
9
+ def minimumNumber (n , password ):
10
+ # Return the minimum number of characters to make the password strong
11
+ numbers = list ("0123456789" )
12
+ lower_case = list ("abcdefghijklmnopqrstuvwxyz" )
13
+ upper_case = list ("ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
14
+ special_characters = list ("!@#$%^&*()-+" )
15
+ count = 0
16
+ length = len (password )
17
+ flagn = 0
18
+ flagl = 0
19
+ flagu = 0
20
+ flags = 0
21
+ for i in password :
22
+ if i in numbers :
23
+ flagn = 1
24
+ for i in password :
25
+ if i in lower_case :
26
+ flagl = 1
27
+ for i in password :
28
+ if i in upper_case :
29
+ flagu = 1
30
+ for i in special_characters :
31
+ if i in password :
32
+ flags = 1
33
+ if flagn == 0 :
34
+ count += 1
35
+ if flagu == 0 :
36
+ count += 1
37
+ if flagl == 0 :
38
+ count += 1
39
+ if flags == 0 :
40
+ count += 1
41
+
42
+ check = length + count
43
+ if check < 6 :
44
+ count = count + (6 - (length + count ))
45
+ return count
46
+
47
+ if __name__ == '__main__' :
48
+
49
+ n = int (input ())
50
+
51
+ password = input ()
52
+
53
+ answer = minimumNumber (n , password )
54
+
55
+ print (answer )
You can’t perform that action at this time.
0 commit comments