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