Level 7 : What is the output of the below code?


list1 = [1,3,4]
list2 = list1
list2.append(2)
print(list1)

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