Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort list

# example list, product name and prices
price_data = [['product 1', 320.0],
             ['product 2', 4387.0],
             ['product 3', 2491.0]]

# sort by price
print(sorted(price_data, key=lambda price: price[1]))
Source by wikidocs.net #
 
PREVIOUS NEXT
Tagged: #python #sort #list
ADD COMMENT
Topic
Name
7+1 =