Level 6 : What will be the output of the following Python code?


list1 = [1, 3]
list2 = list1
list1[0] = 4
print(list2)

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