Skip to content

Commit cebbf56

Browse files
authored
Merge pull request TheAlgorithms#34 from edawine/patch-1
Add another randomness into the password generator
2 parents b56cb26 + 4b43a2f commit cebbf56

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎other/password_generator.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
importstring
2-
fromrandomimport*
2+
importrandom
33

4-
letters=string.ascii_letters
5-
digits=string.digits
6-
symbols=string.punctuation
4+
letters=[letterforletterinstring.ascii_letters]
5+
digits=[digitfordigitinstring.digits]
6+
symbols=[symbolforsymbolinstring.punctuation]
77
chars=letters+digits+symbols
8+
random.shuffle(chars)
89

910
min_length=8
1011
max_length=16
11-
password=''.join(choice(chars) forxinrange(randint(min_length, max_length)))
12-
print('Password: %s'%password)
12+
password=''.join(random.choice(chars) forxinrange(random.randint(min_length, max_length)))
13+
print('Password: '+password)
1314
print('[ If you are thinking of using this passsword, You better save it. ]')

0 commit comments

Comments
(0)