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