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