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