Level 3 : What will this code output?


lst = [1, 2, 3, 4]
for i in range(len(lst)):
    lst.insert(i, lst.pop())
print(lst)

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