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