-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRandom Password Generator
48 lines (34 loc) · 1.22 KB
/
Random Password Generator
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
import random
import string
rnd_letters = string.ascii_letters
rnd_letters = list(rnd_letters.strip())
helper_med = ["!", "^", "+", "%", "=", "?", "_", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
helper_med = helper_med + rnd_letters
def random_password():
password = list()
hard_password = list()
answer = input("Select the security level of your password (Low/Medium/Hard)")
if answer == "low":
for i in range(8):
rnd = random.randrange(0, 10)
password.append(rnd)
s = [str(i) for i in password]
password = "".join(s)
print("Your randomly created password =", password)
if answer == "medium":
random.shuffle(helper_med)
for i in range(0, 12):
a = str(helper_med[i])
password.append(a)
s = [str(i) for i in password]
password = "".join(s)
print("Your randomly created password =", password)
if answer == "hard":
random.shuffle(helper_med)
for i in range(18):
a = str(helper_med[i])
password.append(a)
s = [str(i) for i in password]
password = "".join(s)
print("Your randomly created password =", password)
random_password()