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 | 1736+ Python FAQs | Share
benefit | data-structure | iterable | comment | memory | bitwise-operator | context-manager | lists | counter-function | string-iteration | regex | type-conversion | numeric | oop | data-structures | input-function | mathematics | default-mutable-argument | yield | control-flow | matrix-list-comprehension | lambda | complex-number | global | list-comprehension | else-statement | boolean | data-type | min-function | numpy | formal-and-actual-parameter | escape-operator | classes | higher-order-function | tuple-unpacking | list-method | while-and-for-loop | operators | class-and-instance-variable | loops | join | descriptors | data-type | data-structure | file-handling | statement | __future__ | operator-and | frozenset | round | type-conversion | module | deep-copy | init | asyncio-module | math-copysign | indentation | overflow | installation | file | access-modifier | library | class | generator | string-formatting | id-function | arithmetic-expression | file-handling | object-attribute | identity-operator | goto-function | function-and-scope | list | function | int | touples | logical-operator | encapsulation | input-function | recurssion | boolean-and-non-boolean | string-concatenation | mysql | global-variable | operator | docstring | logical-operator | static-method | magic-method | choice | exception-handling | call | lambdas | datatype | debugging | built-in | recursion | zip | max-min | global-variable | assert | attribute | min-max-function | round-function | enumerate() | control-statement | import-method | lambda-function | for | error-handling | implementation | while-loop | head-and-tail | filter-function | string-slicing | functional-programming | set | string-formatting | version-check | asyncio | turtle | def | precedence | file_handling | pandas | invalid-list | fabs-function | match | conditional-statement | random | operand | immutable-data-type | loop-control | typeerror | package-management | namedtuple | list-vs-tuple | async | expand-tab | functions | variable | built-in-function | assignment-operator | tuple | print-statement | decimal | python | print | string-manipulation | basic | regular-expression | raise | compute | collection | pep | indexing | operator-or | syntax-error | slice | matplotlib | python-history | command-line-parsing | sorting | odd-number | conversion | gil | loop | interpreter | zfill-function | datetime | center | sys | constructor | swapping | list-join | version | polymorphism | sys-module | thread | logical-operation | exception-handling | feature | dictionaries | immutability | append | threading | postfix | iterator | dicts | list-mutation | parameter | scientific-notation | python-repl | mapping-function | condition | map-function | return-statement | factorial-function | python-django | random-function | filter | format | exponentiation | objects | stack | destructor | input | string-method | sum() | list-operation | list-slicing | operator-overloading | heap-memory | floating-point-precision | copy | memory-management | inherit | software-design | array | keyword | data_structure | range | class-and-inheritance | arithmetic-operation | exception | list-comprehension | sum-function | decorator | list-indexing | shallow-copy | integer | __all__-attribute | while-else-loop | binary-operation | syntax | precedence-and-associativity | encoding | python-module | method | methods | identifier | string | error | counter | inheritance | sorted | bitwise-operator | __init_subclass__ | staticmethod | rollback | generators | virtual-environment | nested-loop | collections | string-method | application | expression | built-in-function | design-principle | generators-in-python | type_conversion | control-flow | comprehension | name-mangling | multithreading | function-argument | matrix | string-slicing | split | zip-function | comparison | math | pickling-&-unpickling | complex | global-keyword | mathematical-function | oops | multiple-inheritance | with-statement | slicing | update | pseudocode | binary | python_version | multiprocessing | operations | syntax-error | identity-operator | bitwise | class-and-object | conditional-statement | syntaxerror | set-operation | virtual-environment | dictionary | mutable | namespace ...