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