From 4951a96bdbdd4a3ac46423c4a3bce18227633be6 Mon Sep 17 00:00:00 2001 From: Juan Tovar Date: Sun, 26 Jul 2020 08:56:35 -0700 Subject: [PATCH] Solved by Juan Jose Tovar --- src/main.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index fc9a525..5cbb892 100644 --- a/src/main.py +++ b/src/main.py @@ -1,13 +1,32 @@ # Resolve the problem!! import string +import random SYMBOLS = list('!"#$%&\'()*+,-./:;?@[]^_`{|}~') +UPPER_CASE = list('ABCDHJKRSTXYZ') +LOWER_CASE = list('abcdhjkrstxyz') +NUMBERS = list('1234567890') def generate_password(): + # Start coding here - - + full_string = SYMBOLS + UPPER_CASE + LOWER_CASE + NUMBERS + + passwd = '' + while validate(passwd) == False: + passwd_gen = [] + i = random.randint(8,16) + while i > 0: + rand_char = random.choice(full_string) + passwd_gen.append(rand_char) + i-=1 + + passwd = ''.join(passwd_gen) + + return passwd + + def validate(password): if len(password) >= 8 and len(password) <= 16: