Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def names_by_popularity(names_dict: dict) -> str:
- r"""
- Create a string used to print the names by popularity.
- Format:
- 1. name: number of people + "\n"
- ...
- Example:
- 1. Kati: 100
- 2. Mati: 90
- 3. Nati: 80
- ...
- :param names_dict: dictionary of the names (key is name, value is count)
- :return: string
- """
- pass
- if __name__ == '__main__':
- example_names = ("Kati:F\n" * 1000 + "Mati:M\n" * 800 + "Mari:F\n" * 600 + "Tรตnu:M\n" * 400).rstrip("\n").split(
- "\n")
- print(names_by_popularity(male_names)) # -> 1. Mati: 800 #2. Tรตnu: 400#(empty line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement