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