Level 9 : What will be the output of the following Python code?


list1 = [1,3]
list2 = list1
list1[0] = 4
print(list2)

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