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