File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
- import string
2
- import random
1
+ import string #String module will import all the nessary ascii character
2
+ import random #random module help us to import functions needed to generate random element.
3
3
4
- passwrd = string .ascii_letters + string .digits + string .punctuation
4
+ passwrd = string .ascii_letters + string .digits + string .punctuation #This will generate a string consist of all ascii character.
5
5
6
6
numPass = int (input ("How many passwords do you need to be generated? " ))
7
7
length = int (input ("Enter the length of the password(s): " ))
11
11
for pwd in range (numPass ):
12
12
pw = ''
13
13
for c in range (length ):
14
- pw += random .choice (passwrd )
15
- print (pw )
14
+ pw += random .choice (passwrd ) # Choice() function returns a random element from a iterable element.
15
+ print (pw )
You can’t perform that action at this time.
0 commit comments