Advertisement
UniQuet0p1

Untitled

Oct 7th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. def remove_keys(keys_to_remove: list, dictionary: dict) -> dict:
  2. """
  3. Filter out every dictionary element if its key is in given list.
  4.  
  5. :param keys_to_remove: List of keys to remove
  6. :param dictionary: dict
  7. :return: Dict without given keys
  8. """
  9.  
  10.  
  11. def remove_from_values(values_to_remove: list, dictionary: dict) -> dict:
  12. """
  13. Filter out every dictionary element if its value is in given list.
  14.  
  15. :param values_to_remove: List of values to remove
  16. :param dictionary: dict
  17. :return: Dict without given values
  18. """
  19. pass
  20.  
  21.  
  22. def sort_keys_by_alphabet(dictionary: dict) -> list:
  23. """
  24. Sort dictionary keys in descending alphabetical order.
  25.  
  26. {"doggo": 5, "pupper": 6} == ["pupper", "doggo"]
  27.  
  28. :param dictionary: dict
  29. :return: List of keys which are sorted in descending alphabetical order
  30. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement