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