-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpassword generator.py
More file actions
113 lines (51 loc) · 1.43 KB
/
password generator.py
File metadata and controls
113 lines (51 loc) · 1.43 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python
# coding: utf-8
# In[12]:
import random
while True:
try:
length=int(input('Enter the length of password(min:8/max:20):'))
except:
print('Enter an integer value!!')
else:
if length<8 or length>20:
continue
else:
break
lower_case=['q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m']
upper_case=[]
password=''
for letter in lower_case:
upper_case.append(letter.upper())
# In[13]:
numbers=['0','1','2','3','4','5','6','7','8','9',]
special_characters=['!','@','#','$','%','^','&','*','-','_','/','?']
random.shuffle(lower_case)
random.shuffle(upper_case)
random.shuffle(numbers)
random.shuffle(special_characters)
# In[14]:
password+=random.choice(lower_case)+random.choice(upper_case)+random.choice(numbers)+random.choice(special_characters)+random.choice(upper_case)+random.choice(lower_case)+random.choice(special_characters)+random.choice(numbers)
# In[15]:
for n in range(length-8):
password+=random.choice(lower_case)
# In[ ]:
# In[16]:
password
# In[17]:
temp_pass=list(password)
# In[18]:
random.shuffle(temp_pass)
# In[19]:
temp_pass
# In[20]:
final_password=''
#passw=final_password.join(temp_pass)
for char in temp_pass:
final_password+=char
# In[21]:
final_password
# In[22]:
print(f"The password is:{final_password}")
# In[ ]:
# In[ ]: