GroZnik81

Untitled

Dec 13th, 2020
20
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import re
  2. n = 3
  3. password_data =[]
  4. pattern =r"(U$)(?P<username>[A-Z][a-z]{2,})\1(P@$)(?P<password>[a-zA-Z]{5,}\d+)\3"
  5. for _ in range(n):
  6. data = input()
  7.  
  8. matches =re.finditer(pattern,data)
  9. for match in matches:
  10. result = match.groupdict()
  11. password_data.append(result)
  12.  
  13. if len(password_data) != 0:
  14. print("Registration was successful")
  15. else:
  16. print("Invalid username or password")
  17. for value in password_data:
  18. print(f"Username: {value['username']}, Password: {value['password']}")
  19. print(f"Successful registrations: {len(password_data)}")
  20.  
RAW Paste Data