Level 9 : What will be the output of the following Python code?


x = (i for i in range(3))
for i in x:
    print(i)

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