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