-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPassgen.py
21 lines (21 loc) · 871 Bytes
/
Passgen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import random
length=int(input("Password length"))
nopass=int(input("no of passwords required"))
chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
numbers="0123456789"
symbols="!~@#$%^&*/.,:';"
password=''
number=int(input("numbers required(1/0)")) # if you need numbers in your Password enter 1(True) else 0(False)
symbol=int(input("symbols required(1/0)")) # if you need symbols in your Password enter 1(True) else 0(False)
for l in range(nopass):
password=''
for i in range(length):
if number==1 & symbol==1:
password+=random.choice(chars+numbers+symbols)
elif number==1 & symbol==0:
password+=random.choice(chars+numbers)
elif number==0 & symbol==1:
password+=random.choice(symbols+chars)
else:
password+=random.choice(chars)
print(password)