Advertisement
aneliabogeva

User Logins

Jul 3rd, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. command = input()
  2. name_dict = {}
  3. counter = 0
  4.  
  5. while not command == 'login':
  6. data = [item for item in command.split(" -> ")]
  7. name_dict[data[0]] = data[1]
  8. command = input()
  9.  
  10. command=input()
  11.  
  12. while not command == "end":
  13. #data_2 = [item for item in command.split(" -> ")]
  14. key, value = command.split(" -> ")
  15. if key in name_dict:
  16. if value == name_dict[key]:
  17. print(f"{key}: logged in successfully")
  18. else:
  19. print(f"{key}: login failed")
  20. counter +=1
  21. else:
  22. print(f"{key}: login failed")
  23. counter += 1
  24. command = input()
  25.  
  26. print(f"unsuccessful login attempts: {counter}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement