Level 10 : What will be the output of the following Python code?


A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
B = [[3, 3, 3],
     [4, 4, 4],
     [5, 5, 5]]
[B[row][col]*A[row][col] for row in range(3) for col in range(3)]

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