Skip to content

Commit faf17c7

Browse files
authored
Update password.py
Added comments ,So that beginner level python developer could understand the basic functionality of functions imported by random module.
1 parent c0945bc commit faf17c7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

RandomPassword/password.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

66
numPass = int(input("How many passwords do you need to be generated? "))
77
length = int(input("Enter the length of the password(s): "))
@@ -11,5 +11,5 @@
1111
for 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)

0 commit comments

Comments
 (0)