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


A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]
[A[i][i] for i in range(len(A))]

Author: KaivalyaG | Tags: matrix | 1736+ Python FAQs | Share
set | for | classes | sys | operators | scientific-notation | exception | version | inheritance | mysql | attribute | assert | raise | else-statement | invalid-list | sum() | list-slicing | escape-operator | list-comprehension | arithmetic-expression | built-in-function | comment | installation | keyword | datetime | precedence-and-associativity | multiple-inheritance | math | import-method | enumerate() | print-statement | input-function | overflow | parameter | docstring | dictionaries | global | python-history | context-manager | loop | fabs-function | matrix | round-function | id-function | mathematical-function | max-min | asyncio | math-copysign | nested-loop | mutable | collections | binary-operation | python_version | oop | class-and-object | generators-in-python | module | application | memory | default-mutable-argument | split | dictionary | control-flow | syntax-error | tuple | statement | sorting | yield | namespace | logical-operator | __all__-attribute | postfix | staticmethod | built-in | factorial-function | input | boolean | zip | pep | memory-management | inherit | syntax | list-operation | random | global-variable | type-conversion | operator-and | file | touples | operator | call | sys-module | iterator | shallow-copy | virtual-environment | oops | python-module | virtual-environment | sorted | string-formatting | conversion | numeric | python | loops | higher-order-function | list-indexing | operand | complex-number | slice | generators | benefit | magic-method | filter | thread | multiprocessing | while-else-loop | method | pickling-&-unpickling | python-repl | string-manipulation | type_conversion | boolean-and-non-boolean | feature | asyncio-module | functions | indentation | name-mangling | immutability | bitwise-operator | regex | integer | init | string-method | decimal | min-max-function | encapsulation | threading | center | lists | with-statement | expand-tab | binary | object-attribute | polymorphism | namedtuple | software-design | odd-number | numpy | string-slicing | list-vs-tuple | __init_subclass__ | pandas | recurssion | swapping | int | random-function | logical-operation | floating-point-precision | decorator | interpreter | __future__ | multithreading | assignment-operator | arithmetic-operation | bitwise-operator | collection | typeerror | destructor | choice | array | goto-function | frozenset | formal-and-actual-parameter | recursion | data-type | constructor | sum-function | loop-control | function-argument | functional-programming | counter-function | turtle | input-function | error | indexing | generator | class | lambda | identity-operator | lambdas | slicing | built-in-function | control-flow | comprehension | function-and-scope | pseudocode | while-loop | logical-operator | encoding | file-handling | methods | package-management | rollback | update | bitwise | string-slicing | zfill-function | min-function | list-join | format | exception-handling | data-structure | syntax-error | class-and-inheritance | stack | identifier | basic | list-method | design-principle | def | heap-memory | syntaxerror | command-line-parsing | string-iteration | access-modifier | print | data-type | function | control-statement | regular-expression | global-variable | debugging | tuple-unpacking | descriptors | expression | exponentiation | lambda-function | counter | iterable | data-structure | complex | static-method | implementation | append | condition | list-comprehension | matplotlib | exception-handling | identity-operator | version-check | objects | variable | data-structures | round | file-handling | while-and-for-loop | string-concatenation | map-function | string-formatting | datatype | deep-copy | conditional-statement | matrix-list-comprehension | async | range | comparison | file_handling | compute | filter-function | type-conversion | dicts | operator-or | python-django | join | copy | string-method | error-handling | conditional-statement | operations | data_structure | precedence | head-and-tail | operator-overloading | mapping-function | gil | immutable-data-type | match | mathematics | library | set-operation | list-mutation | list | string | global-keyword | return-statement | class-and-instance-variable | zip-function ...