Level 1 : What does this print?


lst = [10, 20, 30, 40]
lst[:2], lst[2:] = lst[2:], lst[:2]
print(lst)

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