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