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