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