I'm asking this question because none of the answers given here: Sort a list by multiple attributes? work for me.
I've built a web scraper for an online market. I get the price, year of production and location of the car (city where the seller lives). I want to sort the list that by the price (lower price = better), year of production (newer = better), and the distance from the seller to buyer (i will calculate it with geopy, and shorter distance = better) so I can find the best car for the buyer. I tried using sorted() but I didn't manage to get it to work.
Here is what my list looks like:
The tuples are formatted like this: (price, year of production, distance)
cars_info = [(10000, 2013, 40), (13000, 2012, 50), (20000, 2016, 100)]