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