Level 10 : What will this code output?


def double_yield():
    yield 1
    yield from [2, 3, 4]
    yield 5

g = double_yield()
print(list(g))

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