Advertisement
UniQuet0p1

Untitled

Oct 9th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def get_unique_values(dictionary: dict) -> list:
  2. """
  3. Return the list of unique dict values.
  4.  
  5. get_unique_values({1: "a", 2: "b"})) => ["a", "b"]
  6. get_unique_values({1: "a", 2: "b", 3: "a"})) => ["a", "b"]
  7.  
  8. The order is not important.
  9. :param dictionary: Dict to be processed.
  10. :return: List of unique values.
  11. """
  12. new = []
  13. for letter in dictionary:
  14. if dictionary[letter] in new:
  15. break
  16. else:
  17. new.append(dictionary[letter])
  18. return new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement