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


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

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