-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.py
More file actions
57 lines (44 loc) · 986 Bytes
/
Copy pathpassword.py
File metadata and controls
57 lines (44 loc) · 986 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
45
46
47
48
49
50
51
52
53
54
55
56
57
# Global
score = 0
uppercase = False
lowercase = False
specialchar = False
digit = False
special_chars = "!@#$%^&*"
# User input
user_input = input("Enter your password: ")
# Length Validator
if len(user_input) >= 8:
score += 1
if len(user_input) >= 12:
score += 1
if len(user_input) >=15:
score += 1
if len(user_input) >=25:
score += 1
# Universal
for char in user_input:
if char.isdigit():
digit = True
if char in special_chars:
specialchar = True
if char.islower():
lowercase = True
if char.isupper():
uppercase = True
if digit:
score += 1
if specialchar:
score += 1
if lowercase:
score += 1
if uppercase:
score += 1
# Give the score to the user
if score <= 2:
print("Weak Password\nChange Immediately!!")
elif 3 <= score <= 5:
print("Moderate Strength\nConsider changing.")
elif score > 5:
print("Strong Password!\nThanks for using Garv's Password Analyser!")
print(score)