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