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