Level 10 : What os the output of the following code?


a = [[]]*2
a[1].append(6)
print(a)

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