Answer the question
In order to leave comments, you need to log in
Importing the random module and using the attributes gives something like the following error: module 'random' has no attribute 'randit'. What is it connected with?
If needed, here is the code:
import random
letters = 'qwertyuiopasdfghjklzxcvbnm'
signs = '[email protected];:'
a = True
while a == True:
mod = input('''enter the number 1 to generate a password
, enter the number 2 to stop the program
''')
if mod == '2':
a == False
elif mod == '1':
pasword = ''
password_len = random.randint(8, 16)
for i in range(password_len):
variant = random.randint(1,3)
if variant == 1:
number = random.random()
password.append(number)
elif variant == 2:
letter = letters[random.randit(1, letters.len)]
letters_variant =random.randint(1, 2)
if letters_variant== 1:
letter = letter.upper()
password.uppend(letter)
else:
sign = signs[ random.randit(1, signs.len)]
password.uppend(sign)
print(password)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question