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