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