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