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