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