Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def team_lineup(*args):
- countries = {}
- for player, country in args:
- if country not in countries:
- countries[country] = []
- countries[country].append(player)
- result = ""
- for country, players in sorted(countries.items(), key=lambda item: (-len(item[1]), item[0])):
- result += f"{country}:\n"
- for player in players:
- result += f" -{player}\n"
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement