Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python custom array sort

>>> sorted(pokemon, key=lambda x: x[2])		# sort by attack power, by this way
>>> pokemon.sort(key=lambda x: x[2])		# or by this way
#Date is like this
[('Charmander', 'Fire', 52),
 ('Blastoise', 'Water', 83),
 ('Beedrill', 'Poison', 90)]
Source by learnpython.com #
 
PREVIOUS NEXT
Tagged: #python #custom #array #sort
ADD COMMENT
Topic
Name
6+6 =