Level 9 : what is the output of the following code?


def creating_gen(index):  
    months = ['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']  
    yield months[index]  
    yield months[index+2]  
next_month = creating_gen(3)  
print(next(next_month), next(next_month))

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