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