Skip to content

Commit 27cd184

Browse files
authored
Create password.py
1 parent 6d1400f commit 27cd184

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

password.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import random
2+
import string
3+
4+
def generate_password(length=12):
5+
characters = string.ascii_letters + string.digits + string.punctuation
6+
password = ''.join(random.choice(characters) for _ in range(length))
7+
return password
8+
9+
# Example: Generate a random password of length 12
10+
password = generate_password()
11+
print("Random Password:", password)

0 commit comments

Comments
 (0)