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