/
i_918
/
python_wednesday
Обзор
Документация
Войти
/
i_918
/
python_wednesday
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
01.10/password.py
53 строки
2 KB
i_918
добавлены пропавшие папки
10 ноя 2025, 16:36
10 ноя 2025, 16:36
b4d8b25
Код
Авторство
О чём код?
import random import string def generate_password(length, chars): password = "" for i in range(length): password += random.choice(chars) return password print("==========================================") print(" ГЕНЕРАТОР СЛУЧАЙНЫХ ПАРОЛЕЙ") print("==========================================") print() length = int(input("Введите длину пароля (минимум 4):\n")) use_lowercase = input("Включать строчные буквы (a-z)? (y/n):\n").lower() use_uppercase = input("Включать прописные буквы (A-Z)? (y/n):\n").lower() use_digits = input("Включать цифры (0-9)? (y/n):\n").lower() use_special = input("Включать специальные символы (!@#$%)? (y/n):\n").lower() use_lowercase = use_lowercase == "y" use_uppercase = use_uppercase == "y" use_digits = use_digits == "y" use_special = use_special == "y" if not use_lowercase and not use_uppercase and not use_digits and not use_special: print("\nВы не выбрали ни одного типа символов! Используем все типы.") use_lowercase = True use_uppercase = True use_digits = True use_special = True chars = "" if use_lowercase: chars += string.ascii_lowercase if use_uppercase: chars += string.ascii_uppercase if use_digits: chars += string.digits if use_special: chars += "!@#$%^&*()_+-=[]{}|;:,.<>?" password = generate_password(length, chars) print("==========================================") print("Ваш пароль:") print(password) print("==========================================")