Level 1 : what is the output for the below code?


a = [1, 2, 3]
b = (i for i in a if i % 2 == 0)
print(next(b))

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