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