-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
34 lines (24 loc) · 830 Bytes
/
Copy pathscript.py
File metadata and controls
34 lines (24 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import random
import string
from string import ascii_letters, digits, punctuation
def generate(lenght_min):
characters = string.ascii_letters + string.digits + string.punctuation
password = ""
criteria = False
number = False
special_character = False
letters = False
while not criteria or len(password) < lenght_min:
new_char = random.choice(characters)
password += new_char
if new_char in digits:
number = True
elif new_char in punctuation:
special_character = True
elif new_char in ascii_letters:
letters = True
criteria = number and special_character and letters
return password
print("Choose a minimum lenght of the password:")
pwd = generate(int(input()))
print(pwd)