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