Level 10 : How does the sort() method work in Python?


sort_list = lambda x:x.sort()
numbers = [9,2,7,2]
sort_list(numbers)
print(numbers)

Author: Pavan | Tags: sorting | 1859+ Python FAQs | Share
version-check | boolean-and-non-boolean | filtering-and-indexing | else-statement | datetime | conditional-statement | binary | asyncio-module | lambda | append | immutable-data-type | list-join | bitwise-operator | error | context-manager | list-comprehensions | comprehension | assignment-operators | lambda-function | built-in-function | identifier | data-type-conversions | __all__-attribute | collections | file_handling | complex | application | handling-missing-values-(fillna,-dropna) | precedence-and-associativity | access-modifier | reading-and-writing-large-files-efficiently | loops | built-in-modules | __future__ | bitwise-operator | multiple-inheritance | aggregating-data-with-functools.reduce() | data_structure | min-max-function | list-method | operator-overloading | package-management | escape-operator | data-structure | creating-and-starting-threads | difference-between-threads-and-processes | multithreading | list-operation | compute | python-operators | higher-order-function | print | pickling--unpickling | list-mutation | operator-and | logical-operator | file | input-function | lambdas | methods | counter | module | dictionary | intering | list-comprehension | operator | python-django | polymorphism | raise | list-vs-tuple | list,-set,-and-dictionary-comprehensions | keyword | mysql | center | loop-control | mutable | parsing-with-strptime | loop | matrix | namedtuple | head-and-tail | goto-function | control-flow | memory | operators | assignment-operator | indexing | matrix-list-comprehension | managing-directories-with-os-and-shutil | mapping-function | multiple-inheritance | logical-operator | pep | benefit | pandas | quantifiers-(*,-+,-?,-{}) | matplotlib | iterator | python-module | basic | lists | def | pseudocode | data-structures-in-python | debugging | floating-point-precision | generators | oops | file-handling | arithmetic-operation | for | max-min | logical-operation | random | deep-copy | decimal | multiple-except-blocks | reading-and-writing-files | random-function | assert | parameter | numeric | oop | id-function | introduction-to-python | loop-control-statements | datetime.date,-datetime.time,-datetime.datetime | map-function | binary-operation | counter-function | match | bitwise | encoding | anchors-(^,-$) | python-syntax-and-structure | dictionary-methods | arbitrary-arguments-(*args,-**kwargs) | global-variable | list-methods-and-slicing | boolean | data-structure | booleans | list-slicing | overflow | postfix | interpreter | control-flow | operand | name-mangling | complex-number | opening-files-(open()) | conditional-statement | method | directory-operations | integers | math-copysign | defining-functions | raise-statement | magic-method | format | multiprocessing | operator-or | mathematics | filter-function | destructor | functional-programming | odd-number | dictionaries | error-handling | print-statement | implementation | formatting-with-strftime | global | min-function | data-type | exception | literal-characters-and-special-characters | logical-operators | python | memory-management | precedence | call | joining-and-merging-dataframes | object-attribute | class-and-object | operations | indexing:-loc-vs-iloc | type-conversion-and-casting | overriding-methods | introduction-to-threads | thread | mathematical-function | nested-loop | pass | tuple-unpacking | condition | unit-testing | tuple | datatype | collection | math | objects | while-else-loop | built-in | python-repl | thread-synchronization | boolean-masking | using-map()-for-transformations | numpy | python-history | comparison | iterable | default-arguments | type-conversion | expression | sorting-and-ranking | using-join()-and-is_alive()-methods | method-overloading | membership-operators-(in,-not-in) | list | command-line-parsing | factorial-function | decorator | staticmethod | python_version | namespace | conversion | data-types | init | range | threading | regular-expressions | fabs-function | global-keyword | copy | arithmetic-expression | dataframe-and-series-objects | regular-expression | classes | while-and-for-loop | working-with-temporary-files-using-tempfile | advanced-file-operations | dicts | using-os-and-pathlib-modules | zip-function | string-method | turtle | introduction-to-multiprocessing | virtual-environment | sys | why-use-multiprocessing-over-threading?-(gil) | exception-handling | input-function | heap-memory | scientific-notation | docstring | type_conversion | input | array | variable | string-manipulation | functions | sets | constructor | rollback | round-function | set | dictionary-comprehensions | slicing | thread-safe-data-structures-(queue.queue) | statement | slice | software-design | working-with-file-paths | function-argument | working-with-binary-files-(rb,-wb) | choice | string-formatting | built-in-function | shallow-copy | import-method | update | class | inherit | static-method | attribute | tuple-methods | exception-handling | formal-and-actual-parameter | invalid-list | sorted | floats | string | syntax-error | sorting | installation | conditional-statements | while-loop | class-and-inheritance | exponentiation | string-methods | function | using-yield-in-functions | using-the-threading-module | test-discovery | descriptors | file-handling | control-statement | syntax-error | tuples | asyncio | using-else-and-finally | comment | feature | async | creating-custom-modules | zfill-function | using-lists-as-stacks | walking-through-directories-using-os.walk() | design-principle | frozenset | else | version | string-iteration | global-variable | using-assertions-(assertequal,-assertraises) | while-loops | writing:-write(),-writelines() | data-structures | string-concatenation | default-mutable-argument | generators-in-python | class-and-instance-variable | syntaxerror | string-formatting | inheritance | strings | regex | string-method | functional-programming | generator | __init_subclass__ | working-with-dates-and-times | class-decorators | zip | expand-tab | sys-module | immutability | enumerate() | return-statement | list-comprehension | type-conversion | recurssion | set-operation | yield | encapsulation | identity-operators-(is,-is-not) | function-and-scope | with-statement | sum-function | gil | filter | virtual-environment | swapping | join | recursion | key-value-pairs | reading:-read(),-readline(),-readlines() | syntax | int | round | identity-operator | indentation | split | stack | iterators | string-slicing | time-series-with-pandas | typeerror | identity-operator | sum() | string-slicing | list-indexing | integer | lambda-functions | library | touples | error-handling | data-type | single-inheritance ...