From f57a965bec42f655e6f2230b0ea7b8ce573f1232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20A=2E=20P=C3=A9rez=20Garay?= Date: Tue, 11 Aug 2020 01:33:12 -0500 Subject: [PATCH] Comleted challenge python 02 --- src/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main.py b/src/main.py index fc9a525..7a57eb8 100644 --- a/src/main.py +++ b/src/main.py @@ -1,11 +1,21 @@ # Resolve the problem!! import string +import random SYMBOLS = list('!"#$%&\'()*+,-./:;?@[]^_`{|}~') def generate_password(): # Start coding here + support_characters = string.ascii_letters + ''.join(SYMBOLS) + string.digits + max_length = random.randint(8,16) + result = ''.join(random.choice(support_characters) for i in range(max_length)) + + if validate(result) != True: + return generate_password() + else: + return result + def validate(password):