Level 10 : What does this code print?


lst = [1, 2, 3, 4]
result = [i for i in lst if lst.index(i) % 2 == 0]
print(result)

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