-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (29 loc) · 1.01 KB
/
main.py
File metadata and controls
31 lines (29 loc) · 1.01 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
import random as rd
digits="0123456789"
small_alphabets="abcdefghijklmnopqrstuvwxyz"
capital_alphabets="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
special_characters="!@#$&+-/*|\?<>,.%"
#To generate a random characters
def generate_password():
digit=rd.choice(digits)
small=rd.choice(small_alphabets)
capital=rd.choice(capital_alphabets)
special=rd.choice(special_characters)
combine=[digit,small,capital,special]
char=rd.choice(combine)
return char
#Main Funciton
if __name__=="__main__":
print("\t\t\t"+"-"*33)
print("\t\t\t\tPASSWORD GENERATOR")
print("\t\t\t"+"-"*33)
password_length=int(input("Enter password length: "))
#if password length is less than 8
while(password_length<8):
print("The minimum password length is 8 ")
password_length=int(input("Enter password length: "))
password=""
for i in range(password_length):
character=generate_password()
password+=character
print("Generate password : "+password)