Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1.1 добавил символы, требуется 3 питон для запуска
- import random
- lowcase = list("qwertyuiopasdfghjklzxcvbnm")
- upcase = list("QWERTYUIOPASDFGHJKLZXCVBNM")
- numbers = list("1234567890")
- characters = list("!@#$%^&*()")
- chars = []
- passlength = 0
- lowercase_true = ''
- upcase_true = ''
- numbers_true = ''
- characters_true = ''
- password = ''
- while lowercase_true != 'Y' and lowercase_true != 'N':
- lowercase_true = input('Do you want lowcase symbols in your password? Type Y or N \n')
- print("You choose lowercase:", lowercase_true)
- while upcase_true != 'Y' and upcase_true != 'N':
- upcase_true = input('Do you want upcase symbols in your password? Type Y or N \n')
- print("You choose upcase:", upcase_true)
- while numbers_true != 'Y' and numbers_true != 'N':
- numbers_true = input('Do you want numbers in your password? Type Y or N \n')
- print("You choose numbers:", numbers_true)
- while characters_true != 'Y' and characters_true != 'N':
- characters_true = input('Do you want characters in your password? Type Y or N \n')
- print("You choose characters:", numbers_true)
- while passlength == 0:
- try:
- passlength = int(input('Enter pass length'))
- print("Pass length", passlength)
- if passlength != 0:
- break
- except Exception:
- print("Invalid number \n")
- if lowercase_true == 'Y':
- chars.extend(lowcase)
- if upcase_true == 'Y':
- chars.extend(upcase)
- if numbers_true == 'Y':
- chars.extend(numbers)
- if characters_true == 'Y':
- chars.extend(characters)
- print("Using chars:", chars)
- for _ in range(passlength):
- password += random.choice(chars)
- print(password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement