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