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