У меня появилась небольшая проблемка: Я сделал генератор паролей, должен быть случайный boolean (has_symbols и has_uppercase).
Если has_symbols = True, то в пароле будет один символ из данного списка: [#, @, !] Если has_uppercase = True, то в пароле будет одна буква верхнего регистра.
Код:
import random, os, string # Imports
while 1: # Infinite cycle!
chars = string.ascii_lowercase + string.digits # Combining all lowercase letters and all digits
random.seed(os.urandom(1024)) # RaNdOmNeSs!!1
password_length = 7 # Password length, you can change it
password = ''.join(random.choice(chars) for length in range(password_length)) # Password generation
print(password) # Printing
input('» ') # Waiting for user to input, so the program can generate a new password
os.system('clear') # Clearing screen