I have issue with a code for generate password (code below)
from random import randint, choice
alphabet_min = [chr(i) for i in range(97, 123)]
alphabet_maj = [chr(i) for i in range(65, 91)]
chiffre = [chr(i) for i in range(48, 58)]
carac_spec = [chr(i) for i in range(33, 48)]
def pwd(n, min1=True, maj=True, chif= True, cs=True):
alphabets = dict()
key = 0
if min1:
alphabets[key] = alphabet_min
key += 1
if maj:
alphabets[key] = alphabet_maj
key += 1
if chif:
alphabets[key] = chiffre
key += 1
if cs:
alphabets[key] = carac_spec
key += 1
mdp = ' '
for i in range(n):
clef = randint(0, key - 1)
mdp += choice(alphabets[clef])
return mdp
When I execute this, nothing appear
Code finding on internet and very beginner in Python code.
Anyone have an idea of the issue ?