0

I wish to sort below list of dictionaries by age key into ascending order without using any built in functions.

[{'Name': 'Alpha', 'Age': 14}, {'Name': 'Bravo', 'Age': 21}, {'Name': 'Charlie', 'Age': 12}]

I wish to have below output.

[{'Name': 'Charlie', 'Age': 12}, {'Name': 'Alpha', 'Age': 14}, {'Name': 'Bravo', 'Age': 21}]

I have done it via sorted function but unable to find a way to do it without same. I believe this should be done via bubble sort method but am unable to implement it.

Many thanks in advance.

Mohit Aswani
  • 185
  • 1
  • 7
  • This question is already answered here : https://stackoverflow.com/questions/72899/how-do-i-sort-a-list-of-dictionaries-by-a-value-of-the-dictionary....Also you can use :```sorted(listname, key=lambda k : k['Age']) ``` – Manvi Jan 18 '23 at 07:10
  • I do not wish to use sorted function as mentioned above. Need not to use built in functions. – Mohit Aswani Jan 18 '23 at 07:22

0 Answers0