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