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