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