Skip to content

Commit e626592

Browse files
Merge pull request #1 from Revved-Up-Ant/patch-1
Way 1 is meant for Minimal Resource Usage and Way 2 for more secure generation.
2 parents 7ca732a + c5bd53a commit e626592

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

password-generator.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
smallans=str(input("Are lowercase Alphabets allowed ? (Y/N) : "))
99
digans=str(input("Are Digits allowed ? (Y/N) : "))
1010
spans=str(input("Are Special Charecters allowed ? (Y/N) : "))
11+
rep=input("Way 1 or Way 2? (1/2) : ")
1112
capans,smallans,digans,spans=capans.title(),smallans.title(),digans.title(),spans.title()
1213
if capans=='Y':
1314
if smallans=='Y':
@@ -58,10 +59,15 @@
5859
quit()
5960

6061
password=""
61-
random.shuffle(comblis)
62-
for i in range(passlen):
63-
q=random.choice(comblis)
62+
if rep=='1':
63+
for i in range(passlen):
64+
password+=comblis[random.randint(0,len(comblis)]
65+
66+
else:
6467
random.shuffle(comblis)
65-
password=password+q
68+
for i in range(passlen):
69+
q=random.choice(comblis)
70+
random.shuffle(comblis)
71+
password=password+q
6672
print("\nGenerated Password is : ",password)
6773
print()

0 commit comments

Comments
 (0)