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