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