Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- friend_list = input().split(", ")
- command = input()
- while command != "Report":
- tokens = command.split(" ")
- cmd = tokens[0]
- name = tokens[1]
- if cmd == "Blacklist":
- idx = friend_list.index(name)
- if name not in friend_list:
- print(f"{name} was not found.")
- else:
- friend_list[idx] = "Blacklisted"
- print(f"{name} was blacklisted.")
- elif cmd == "Error":
- idx = int(name)
- if friend_list[idx] != "Blacklisted" and friend_list[idx] != "Lost":
- print(f"{friend_list[idx]} was lost due to an error.")
- friend_list[idx] = "Lost"
- elif cmd == "Change":
- new_name = tokens[2]
- idx = int(name)
- if 0 <= idx <= len(friend_list) - 1:
- print(f"{friend_list[idx]} changed his username to {new_name}.")
- friend_list[idx] = new_name
- command = input()
- blacklisted = [x for x in friend_list if x == "Blacklisted"]
- lost = [x for x in friend_list if x == "Lost"]
- print(f"Blacklisted names: {len(blacklisted)}\nLost names: {len(lost)}")
- print(" ".join(friend_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement