Advertisement
UniQuet0p1

Untitled

Sep 28th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. def names_by_popularity(names_dict: dict) -> str:
  2.     r"""
  3.    Create a string used to print the names by popularity.
  4.  
  5.    Format:
  6.        1. name: number of people + "\n"
  7.        ...
  8.  
  9.    Example:
  10.        1. Kati: 100
  11.        2. Mati: 90
  12.        3. Nati: 80
  13.        ...
  14.  
  15.    :param names_dict: dictionary of the names (key is name, value is count)
  16.    :return: string
  17.    """
  18.     pass
  19.  
  20.  
  21. if __name__ == '__main__':
  22.     example_names = ("Kati:F\n" * 1000 + "Mati:M\n" * 800 + "Mari:F\n" * 600 + "Tรตnu:M\n" * 400).rstrip("\n").split(
  23.         "\n")
  24. 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