Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort vs sorted python

>>> sorted((3,7,4,9,2,1,7))
[1, 2, 3, 4, 7, 7, 9]
>>> sorted({'one':1, 'two':2,'three':3,'four':4,'five':5})
['five', 'four', 'one', 'three', 'two']
>>> sorted([3,7,4,9,2,1,7])
[1, 2, 3, 4, 7, 7, 9]
>>> sorted('this is a string')
[' ', ' ', ' ', 'a', 'g', 'h', 'i', 'i', 'i', 'n', 'r', 's', 's', 's', 't', 't']
>>>
Source by discuss.codecademy.com #
 
PREVIOUS NEXT
Tagged: #sort #sorted #python
ADD COMMENT
Topic
Name
9+6 =