From ee5fd33c0f9ced6046810503f8a0e0dbe1aca34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Guzm=C3=A1n?= <60590466+odguzmanv@users.noreply.github.com> Date: Tue, 30 Jun 2020 10:43:52 -0500 Subject: [PATCH] Python Challenge 02 completed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tuve más problemas con el git pull que con el problema, por lo que decidí cambiarlo directamente aquí por exhaustismo. --- src/main.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main.py b/src/main.py index fc9a525..9e8f27c 100644 --- a/src/main.py +++ b/src/main.py @@ -6,6 +6,27 @@ def generate_password(): # Start coding here + caracteres = str(SYMBOLS) + string.ascii_letters + string.digits + longitud = random.randint(8,16) + minusculas = random.randint(1,4); + mayusculas = random.randint(1,4); + numeros = random.randint(1,4); + simbolos = random.randint(1,4); + + + + while True: + password = ("").join(random.choice(caracteres) for index in range(longitud)) + if(sum(caracter.islower() for caracter in password) >= minusculas + and sum(caracter.isupper() for caracter in password) >= mayusculas + and sum(caracter.isdigit() for caracter in password) >= numeros): + for caracter in password: + if caracter in SYMBOLS: + False + else: + True + break + return password def validate(password):