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.
33
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.
55
66numPass = int (input ("How many passwords do you need to be generated? " ))
77length = int (input ("Enter the length of the password(s): " ))
1111for pwd in range (numPass ):
1212 pw = ''
1313 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