Level 1 : What will this code output?


lst = [1, 2, 3, 4]
lst[1:3] = [7, 8, 9]
print(lst)

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