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