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