Level 2 : What happens in Python when you use the += operator on a list?


list1 = [1, 2, 3]
list2 = list1
list1 += [4]

Author: VenuEmmela | Tags: list | 1736+ Python FAQs | Share
python-module | pep | multithreading | random | data-structure | virtual-environment | input-function | sys | namespace | list-comprehension | factorial-function | binary | object-attribute | library | immutability | head-and-tail | update | string-iteration | syntax-error | frozenset | global-keyword | int | integer | installation | while-else-loop | matplotlib | return-statement | descriptors | feature | append | sum() | for | assert | exponentiation | global-variable | file-handling | pandas | python-repl | scientific-notation | sorted | magic-method | global-variable | mathematical-function | list-comprehension | generator | lambda | version | class | encoding | conditional-statement | destructor | generators | bitwise-operator | access-modifier | __all__-attribute | keyword | round-function | regex | syntax | multiprocessing | operator-and | memory-management | type-conversion | list-slicing | filter | else-statement | join | match | __init_subclass__ | higher-order-function | statement | control-flow | class-and-inheritance | precedence-and-associativity | matrix-list-comprehension | bitwise-operator | encapsulation | software-design | oop | built-in-function | package-management | threading | string-manipulation | built-in-function | nested-loop | objects | overflow | python-django | boolean | function-argument | class-and-instance-variable | set | logical-operator | counter-function | logical-operation | fabs-function | pseudocode | choice | string-formatting | odd-number | assignment-operator | syntax-error | data-type | format | dictionaries | debugging | enumerate() | random-function | application | syntaxerror | condition | input | deep-copy | range | data-structures | command-line-parsing | raise | split | comprehension | variable | operations | bitwise | min-function | floating-point-precision | immutable-data-type | version-check | call | multiple-inheritance | stack | function-and-scope | while-loop | __future__ | max-min | error-handling | namedtuple | goto-function | sum-function | loops | complex | conditional-statement | parameter | implementation | array | counter | min-max-function | collections | data_structure | string-formatting | swapping | list-indexing | memory | mutable | default-mutable-argument | arithmetic-operation | docstring | mathematics | file_handling | input-function | postfix | mysql | inherit | list-operation | numpy | generators-in-python | rollback | pickling-&-unpickling | compute | attribute | with-statement | python-history | string-slicing | oops | recurssion | method | file-handling | decorator | error | methods | polymorphism | thread | indexing | regular-expression | logical-operator | sys-module | indentation | conversion | zfill-function | dictionary | recursion | python | identity-operator | iterable | print | list-vs-tuple | touples | invalid-list | loop | list-mutation | context-manager | list-method | collection | interpreter | precedence | gil | comparison | slicing | zip-function | type_conversion | mapping-function | string-method | binary-operation | formal-and-actual-parameter | shallow-copy | file | identifier | filter-function | built-in | zip | exception | exception-handling | turtle | string | functional-programming | iterator | loop-control | datatype | constructor | asyncio-module | operator | function | operators | name-mangling | class-and-object | boolean-and-non-boolean | complex-number | module | id-function | while-and-for-loop | comment | copy | global | datetime | type-conversion | sorting | numeric | escape-operator | control-statement | functions | operand | operator-overloading | dicts | math-copysign | heap-memory | data-type | benefit | lists | typeerror | classes | control-flow | tuple | matrix | center | map-function | string-slicing | asyncio | design-principle | expand-tab | string-concatenation | inheritance | string-method | math | operator-or | round | set-operation | identity-operator | data-structure | python_version | exception-handling | tuple-unpacking | basic | init | virtual-environment | async | lambdas | print-statement | decimal | import-method | arithmetic-expression | list-join | list | static-method | yield | lambda-function | staticmethod | def | expression | slice ...