I have this list of dictionaries, which are already sorted based on the first values. How do I continue to sort this list based on its second values as well?
Here is my list of dictionaries:
[{'P3': [7, 117]}, {'P8': [14, 88]}, {'P2': [19, 102]}, {'P4': [19, 95]}]
Desired outcome:
[{'P3': [7, 117]}, {'P8': [14, 88]}, {'P4': [19, 95]}, {'P2': [19, 102]}]
I am in the process of completing a Shortest Job First scheduling assignment in Python. The first value of each key(process) is the cpu burst and the second value is the arrival time, so I would need P4 to go before P2 since its arrival time comes first and they have the same cpu burst.