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