forked from larymak/Python-project-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpassword.py
More file actions
12 lines (8 loc) · 622 Bytes
/
password.py
File metadata and controls
12 lines (8 loc) · 622 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
import string #String module will import all the nessary ascii character
import random #random module help us to import functions needed to generate random element.
passwrd = string.ascii_letters+string.digits+string.punctuation #This will generate a string consist of all ascii character.
numPass = int(input("How many passwords do you need to be generated? "))
length = int(input("Enter the length of the password(s): "))
print("List(s) of Generated passwords: ")
for _ in range(numPass):
print(''.join(random.sample(passwrd, k=length))) #sample() generates an array of random characters of length k