Level 5 : What will this print?


lst = [1, 2, 3, 4]
res = [lst[i:] + lst[:i] for i in range(len(lst))]
print(res)

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