Level 10 : Output of this snippet?


lst = [1, [2, 3], 4]
for sublist in lst:
    if isinstance(sublist, list):
        sublist.append(sublist.pop(0))
print(lst)

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