Skip to content

Commit 424ce18

Browse files
authored
Using Secrets module
1 parent 0bb44a6 commit 424ce18

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#import library
2+
import secrets
3+
import string
4+
5+
#define the combinations by calling characters from string
6+
alphabets = string.ascii_letters
7+
numbers = string.digits
8+
symbols = string.punctuation
9+
10+
combination = alphabets + numbers + symbols
11+
12+
#fix the length of password
13+
length = 8
14+
15+
#generating the password
16+
password = ''
17+
for i in range(length):
18+
password += ''.join(secrets.choice(combination))
19+
20+
#here you the password you got!
21+
print(password)

0 commit comments

Comments
 (0)