Advertisement
Guest User

Ex01

a guest
Mar 14th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import os
  2. import random
  3.  
  4. os.system("cls")
  5.  
  6. usernameList = []
  7. passwordList = []
  8.  
  9. while True:
  10.     fullName = input("Nome completo: ")
  11.  
  12.     # encerra loop
  13.     if fullName == '1':
  14.         os.system("cls")
  15.         break
  16.  
  17.     splitFullname = fullName.split()
  18.     username = splitFullname[0][:1] + splitFullname[1]
  19.  
  20.     if username in usernameList:
  21.         print("Usuário " + username + " já cadastrado\n")
  22.     else:
  23.         usernameList.append(username)
  24.  
  25.         # gera senha temporária
  26.         i = 1
  27.         password = ""
  28.         while i <= 8:
  29.             asciiValue = random.randint(33,255)
  30.             password = password + chr(asciiValue)
  31.             i+=1
  32.  
  33.         passwordList.append(password)
  34.  
  35.  
  36. # imprime resultados
  37. print("Lista de usuários\n\n")
  38. for username in usernameList:
  39.     print(username)
  40.  
  41. for password in passwordList:
  42.     print(password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement