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