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