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