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