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