Password generator and cracker of these // Why does my code not work? someone help me please
It is a code that I made in an idle console on my computer and it works perfectly but when I pass it to the console of sololearn it doesn't work, I don't know what to do because it took me a long time and I don't like it not working import itertools import string from random import * import time letters = string.ascii_letters digits = string.digits chars = letters + digits min_length = 8 max_length = 32 paswd = "".join(choice(chars) for x in range(randint(min_length, max_length))) print("Contraseña generada para crakearla ---->", paswd) time.sleep(5) def guess_password(real): chars = string.ascii_lowercase + string.digits attempts = 0 for password_length in range(1, 9): for guess in itertools.product(chars, repeat=password_length): attempts += 1 guess = ''.join(guess) if guess == real: return 'la contraseña es: {}. encontrada en {} intentos.'.format(guess, attempts) print(guess, attempts) print(guess_password(paswd))