Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lines = input()
- guests = []
- dislike_list =[]
- while not lines == "Stop":
- command_data = lines.split("-")
- command = command_data[0]
- if command == "Like":
- guest = command_data[1]
- meal = command_data [2]
- if guest not in guests:
- guests[guest] = []
- if meal not in guests[guest]:
- guests[guest].append(meal)
- elif command == "Unlike":
- guest = command_data[1]
- meal = command_data[2]
- if guest not in guests:
- print(f"{guest} is not at the party.")
- else:
- if meal in guests[guest]:
- unlike_meal = guests[guest].pop()
- dislike_list.append(unlike_meal)
- print(f"{guest} doesn't like the {meal}.")
- else:
- print(f"{guest} doesn't have the {meal} in his/her collection.")
- lines = input()
- sorted_guests = sorted(guests.items(),key=lambda x: (x[1],x[0]),reverse=True)
- for key, value in sorted_guests:
- print(f"{key}: {', '.join(value)}")
- print(f"Unliked meals: {len(dislike_list)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement