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