Advertisement
eNeRGy90

Untitled

Jan 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. data = {}
  2. unsuccesful = 0
  3. action = None
  4.  
  5. while True:
  6.     inp = input()
  7.     if inp == "end":
  8.         print(f"unsuccessful login attempts: {unsuccesful}")
  9.         break
  10.     if inp == "login":
  11.         action = inp
  12.         continue
  13.  
  14.     (name, password)= inp.split(" -> ")
  15.  
  16.     if action == "login":
  17.         if name in data and data[name] == password:
  18.             print(f"{name}: logged in successfully")
  19.         else:
  20.             print(f"{name}: login failed")
  21.             unsuccesful+= 1
  22.     else:
  23.         data[name] = password
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement