I have just started learning dictionaries and I have a problem with one task that requires me to sort dictionary values alphabetically.
def sort_dictionary(dic: dict) -> dict:
for i, j in dic.items():
sorted_dict = {i: sorted(j)}
print(sorted_dict)
So, for example print(sort_dictionary({"b":["d", "a"], "a":["c", "f"]}))
should give me {"b":["a", "d"], "a":["c", "f"]}
. My code gives
{'b': ['a', 'd']}
{'a': ['c', 'f']}
How can this be fixed? Also, if possible, I will ask you not to use lambda, since I have not yet learned it.