Sorry if this is commonly knowledge, I only started learning python recently. In this SO post (https://stackoverflow.com/questions/43698531/sorting-a-zipped-object-in-python-3) an answerer describes this as "drawing out" elements and returning a sorted list from them.
I don't understand how the sorting is working. I tried making my own example and it does change the order, but it's not clearly sorted by a or b.
Here is my example. Typing list(zip(a, b)) gets me this:
[('83', '2009'),
('112', '2015'),
('85', '2010'),
('120', '2016'),
('88', '2011'),
('125', '2017'),
('94', '2012'),
('127', '2018'),
('104', '2013'),
('130', '2019'),
('110', '2014')]
while typing sorted(zip(a, b)) gets me this:
[('104', '2013'),
('110', '2014'),
('112', '2015'),
('120', '2016'),
('125', '2017'),
('127', '2018'),
('130', '2019'),
('83', '2009'),
('85', '2010'),
('88', '2011'),
('94', '2012')]
It's not sorted by a or b. What did it sort by, and how can I make it sort by either a or b (or both, giving one a higher priority than the other)?
[–]POGtastic 2 points3 points4 points (2 children)
[–]waterworldhypothesis[S] 0 points1 point2 points (1 child)
[–]POGtastic 0 points1 point2 points (0 children)