-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandom_Password_Generator.py
More file actions
50 lines (42 loc) · 1.46 KB
/
Random_Password_Generator.py
File metadata and controls
50 lines (42 loc) · 1.46 KB
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
import string
import random
def password_generator():
caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
small = "abcdefghijklmnopqrstuvwxyz"
numbers = "0123456789"
special = "!@#$%^&*()_+=-{}[]|/?><,."
passlen = input("ENTER YOUR PASSWORD LENGTH : ")
no_caps = input("ENTER YOUR REQUIRED NUMBER OF CAPITAL LETTERS IN PASSWORD : ")
no_small = input("ENTER YOUR REQUIRED NUMBER OF SMALL LETTERS IN PASSOWRD :")
no_nos = input("ENTER YOUR REQUIRED NUMBER OF NUMBERS IN PASSWORD : ")
no_spec = input("ENTER YOUR REQUIRED NUMBER OF SPECIALS IN PASSWORD : ")
if(no_caps + no_small + no_nos + no_spec > passlen or no_caps + no_small + no_nos + no_spec < passlen):
print "WRONG INPUT INFO,PLEASE TRY AGAIN LATER!!!"
else:
password = ''
i = 0
for i in range(no_caps):
password += random.choice(caps)
i = 0
for i in range(no_small):
password += random.choice(small)
i = 0
for i in range(no_nos):
password += random.choice(numbers)
i = 0
for i in range(no_spec):
password += random.choice(special)
jumble = ""
while password:
position = random.randrange(len(password))
jumble += password[position]
password = password[:position] + password[(position + 1):]
return jumble
if __name__ == '__main__':
test_cases = input("how many passwords do you want:")
j = 0
l = []
for j in range(test_cases):
l.append(password_generator())
for passwords in l:
print passwords