Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ca732a

Browse files
Create password-generator.py
1 parent de5ab40 commit 7ca732a

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

‎password-generator.py‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
capchar=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
2+
dig = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
3+
spchar=['!','@','#','$','%','^','&','*','(',')','_','-',',','.']
4+
smallchar=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h','i', 'j', 'k', 'm', 'n', 'o', 'p', 'q','r', 's', 't', 'u', 'v', 'w', 'x', 'y','z']
5+
import random
6+
passlen=int(input("Enter the desired length of password : "))
7+
capans=str(input("Are CAPITAL Alphabets allowed ? (Y/N) : "))
8+
smallans=str(input("Are lowercase Alphabets allowed ? (Y/N) : "))
9+
digans=str(input("Are Digits allowed ? (Y/N) : "))
10+
spans=str(input("Are Special Charecters allowed ? (Y/N) : "))
11+
capans,smallans,digans,spans=capans.title(),smallans.title(),digans.title(),spans.title()
12+
if capans=='Y':
13+
if smallans=='Y':
14+
if digans=='Y':
15+
if spans=='Y':
16+
comblis=capchar+dig+spchar+smallchar
17+
else:
18+
comblis=capchar+dig+smallchar
19+
else :
20+
if spans=='Y':
21+
comblis=capchar+spchar+smallchar
22+
else:
23+
comblis=capchar+smallchar
24+
else:
25+
if digans=='Y':
26+
if spans=='Y':
27+
comblis=capchar+dig+spchar
28+
else:
29+
comblis=capchar+dig
30+
else :
31+
if spans=='Y':
32+
comblis=capchar+spchar
33+
else:
34+
comblis=capchar
35+
else :
36+
if smallans=='Y':
37+
if digans=='Y':
38+
if spans=='Y':
39+
comblis=dig+spchar+smallchar
40+
else:
41+
comblis=dig+smallchar
42+
else :
43+
if spans=='Y':
44+
comblis=spchar+smallchar
45+
else:
46+
comblis=smallchar
47+
else:
48+
if digans=='Y':
49+
if spans=='Y':
50+
comblis=dig+spchar
51+
else:
52+
comblis=dig
53+
else :
54+
if spans=='Y':
55+
comblis=ar+spchar
56+
else:
57+
print("Error, You denied the usage of all possible charecters")
58+
quit()
59+
60+
password=""
61+
random.shuffle(comblis)
62+
for i in range(passlen):
63+
q=random.choice(comblis)
64+
random.shuffle(comblis)
65+
password=password+q
66+
print("\nGenerated Password is : ",password)
67+
print()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /