I have the following dictionary:
employees = [
{'Name': 'Alan Turing', 'age': 25, 'salary': 10000},
{'Name': 'Sharon Lin', 'age': 30, 'salary': 8000},
{'Name': 'John Hopkins', 'age': 18, 'salary': 1000},
{'Name': 'Mikhail Tal', 'age': 40, 'salary': 15000},
]
I now want to sort this dictionary with the key 'age' using Lambda. You can find below how I tried to figure this out:
print(list(map(employees.sort(key = lambda x: x.get('age')), employees)))
I get the following error:
Traceback (most recent call last):
File "<string>", line 10, in <module>
TypeError: 'NoneType' object is not callable
How should I configure the lambda to get the correct output?
Thank you!