Skip to content

Commit 9908204

Browse files
authored
Fix pass_gen.py
conditions[x] -> possible_characters[x] is index based coupling
1 parent 9e0c7e8 commit 9908204

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Password Generator/pass_gen.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def gen_sequence(
1414
str.punctuation,
1515
]
1616
sequence = ""
17-
for x in range(len(conditions)):
18-
if conditions[x]:
19-
sequence += possible_characters[x]
17+
keys = ["lowercase", "uppercase", "digits", "punctuation"]
18+
19+
for key, chars in zip(keys, possible_characters):
20+
if conditions[key]:
21+
sequence += chars
2022
else:
2123
pass
2224
return sequence
@@ -54,7 +56,7 @@ def show_has_characters(cls):
5456
print(cls.has_characters) # print the output
5557

5658
def generate_password(self, lenght):
57-
sequence = PasswordGenerator.gen_sequence(list(self.has_characters.values()))
59+
sequence = PasswordGenerator.gen_sequence(self.has_characters)
5860
print(PasswordGenerator.gen_password(sequence, lenght))
5961

6062

0 commit comments

Comments
 (0)