Level 10 : What is the output for the below code?


def gen():
    yield from range(3)
    yield 10

print(list(gen()))

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