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