fork download
  1. import random
  2. import string
  3. import itertools
  4.  
  5. upper = list(string.ascii_uppercase) # алфавит в верхнем регистре
  6. lower = list(string.ascii_lowercase) # в нижнем
  7. digits = list(string.digits) # цифры
  8. d = "_" # знак подчеркивания
  9. password = [] # готовый пароль
  10. this = [] # все элементы всех списков в одном
  11. all1 = [upper,lower,digits] # списки в списке
  12.  
  13. for x in all1: # вытягиваем все элементы в один список
  14. for item in x:
  15. this.append(item)
  16.  
  17. this.append(d) # добавляем знак подчеркивания в список всех элементов
  18. random.shuffle(this) # перемешиваем список всех элементов
  19. for x in range(8): # создаем пароль
  20. password.append(this[int(random.randrange(0,len(this)))])
  21. print(password)
  22. for i in upper:
  23. if not (upper[upper.index(i)]) in password:
  24. #print(upper.index(i)) # индекс тех элементов, которых нет в пароле
  25. print(password)
  26.  
  27. #this=random.sample(upper+lower+digits,random.randint(0,len(upper+lower+digits)))
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 125, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "./prog.py", line 25
    print(password)
    ^
IndentationError: expected an indented block

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/py_compile.py", line 129, in compile
    raise py_exc
py_compile.PyCompileError: Sorry: IndentationError: expected an indented block (prog.py, line 25)
stdout
Standard output is empty