Nov-21-2019, 08:11 PM
I am trying to create a function in python 3.6 that returns a dictionary with count being the key and list being the value to gather all items with the same count.
This is what I have for code so far:
Thanks for helping!
This is what I have for code so far:
def sorted_dict_content(key_val): return [{k: key_val[k]} for k in sorted(key_val.keys(), reverse=True)]While this code is functional, I am wondering if there is a way I can get the same output by creating a blank list, appending the key-value pairs to it, and returning this list.
Thanks for helping!