Imagine I have a random number of lists of lists, such that every list has the following format: [[%f, %s], [%f, %s], ...]
. So each list has a random number of pairs of a float and a string.
I want to compare all elements of all lists, and write them in another separate list in order of their float value.
Example: If my input lists are
a = [[4.0, "hello"], [3.5, "world"]]
b = [[1.1, "stack"], [2.1, "overflow"], [10.0, "love"], [0.5, "python"]]
c = [[5.6, "programming"]]
I want the output list to be
final = [[0.5, "python"], [1.1, "stack"], [2.1, "overflow"], [3.5, "world"], [4.0, "hello"], [5.6, "programming"], [10.0, "love"]]
Keep in mind that I don't know how many lists I'll have as an input, nor do I know how many elements does each list have. The only solutions I could come up with can't account for those two things, and I'm all out of ideas on how to proceed.
As a last note: this is my first question here, so if I've done something wrong, please let me know so I can fix that and have a proper answer! Thank you.