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