Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicestaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: sorted
Description
Returns a new sorted list from the items in iterable.
Extended Description
The sorted() function returns a new sorted list from the items in the given iterable. It does not modify the original iterable. The function uses a stable sorting algorithm, meaning that when multiple records have the same key, their original order is preserved. The 'key' parameter specifies a function of one argument that is used to extract a comparison key from each element. The 'reverse' parameter, if set to True, sorts the list in descending order.
Read More about sorted from Python Documentation
Function Signature
sorted(iterable: Iterable, *, key: Optional[Callable] = None, reverse: bool = False) -> List
Module: builtins
Parameters
Parameter List
- iterable: Iterable
- key: Optional[Callable]
- reverse: bool
Return
Returns a new sorted list containing all items from the iterable.
Return Type
List
Output
Explanation
These examples show sorting different types of iterables.