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