sorted

http://www.adilwaseem.com/

Introduction
The function sort the list, tuple, or set.

Syntax
sorted(iterable, key=None, reverse=False) --> new sorted list

Parameters
iterable

Examples
The method sort the list.
 >>> x=[22,3,5,55,3,4,56,777,66,21]
>>> sorted(x)
[3, 3, 4, 5, 21, 22, 55, 56, 66, 777]

list.sort
The method sorted the list through list.sort() function.
 >>> a=[343,3434,34145,65,4,22222]
>>> a.sort()
>>> a
[4, 65, 343, 3434, 22222, 34145]

sorted(dict)
This method sorts the dictionary items.
 dict1={'Adil':33, 'John':55, 'Eric':45, 'Robert':19}
sorted(dict1)
>>> dict1
{'Adil': 33, 'John': 55, 'Eric': 45, 'Robert': 19}
>>> 
Comments