mladrad

Friend List and Maintenance

Jun 26th, 2024
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.26 KB | None | 0 0
  1. names_lst = input().split(", ")
  2. black_counter = 0
  3. losted_names = 0
  4. while True:
  5.     command = input().split()
  6.     if command[0] == "Report":
  7.         break
  8.     elif command[0] == "Blacklist":
  9.         name = command[1]
  10.         for i in range(len(names_lst)):
  11.             if names_lst[i] == name:
  12.                 print(f"{name} was blacklisted.")
  13.                 names_lst[i] = "Blacklisted"
  14.                 black_counter += 1
  15.         if black_counter == 0:
  16.             print(f"{name} was not found.")
  17.  
  18.     elif command[0] == "Error":
  19.         index = command[1]
  20.         if int(index) in range(len(names_lst)):
  21.             if names_lst[int(index)] != "Blacklisted" and names_lst[int(index)] != "Lost":
  22.                 print(f"{names_lst[int(index)]} was lost due to an error.")
  23.                 names_lst[int(index)] = "Lost"
  24.                 losted_names += 1
  25.  
  26.     elif command[0] == "Change":
  27.         index = command[1]
  28.         new_name = command[2]
  29.         if int(index) in range(len(names_lst)):
  30.             name = names_lst[int(index)]
  31.             names_lst[int(index)] = new_name
  32.             print(f"{name} changed his username to {new_name}.")
  33.  
  34. print(f"Blacklisted names: {black_counter}")
  35. print(f"Lost names: {losted_names}")
  36. print(' '.join(names_lst))
  37.  
Advertisement
Add Comment
Please, Sign In to add comment