Advertisement
myloyo

Задание 2.6 Модуль random

Nov 4th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import random
  2. import string
  3.  
  4. def id_gen():
  5.     fl_num = random.randint(1, 9)
  6.     mid = random.randint(100, 999)
  7.     id = str(fl_num)+str(mid)+str(fl_num)
  8.     return int(id)
  9.  
  10. def login_gen():
  11.     login = random.sample(string.ascii_lowercase, 6)
  12.     return ''.join(login)
  13.  
  14. def password_gen():
  15.     nums = random.sample(string.digits, 2)
  16.     letter = random.sample(string.ascii_lowercase, 1)
  17.     rest = random.sample(string.ascii_lowercase+string.ascii_uppercase+string.digits, 7)
  18.     password = nums+letter+rest
  19.     random.shuffle(password)
  20.     return ''.join(password)
  21.  
  22. def bd():
  23.     id = id_gen()
  24.     login = login_gen()
  25.     password = password_gen()
  26.     arr = (id, login, password)
  27.     print(*arr)
  28.  
  29. bd()
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement