Level 10 : 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 | 1736+ Python FAQs | Share
string-method | asyncio | module | set | pandas | python-django | return-statement | software-design | exception-handling | data-structure | swapping | parameter | import-method | destructor | debugging | id-function | list-vs-tuple | feature | pseudocode | compute | string-formatting | list-operation | inheritance | condition | matrix | higher-order-function | list-method | arithmetic-operation | string-method | python-history | split | built-in | comprehension | memory | random | logical-operation | loops | identifier | bitwise | class-and-instance-variable | recurssion | math-copysign | string-formatting | decorator | lambda-function | iterable | operators | round-function | else-statement | postfix | mysql | string-slicing | context-manager | threading | list-slicing | error | data-type | global-keyword | sorted | deep-copy | generators-in-python | operator-overloading | benefit | input | string | polymorphism | application | keyword | precedence | package-management | virtual-environment | function | name-mangling | set-operation | sum() | round | default-mutable-argument | mathematical-function | regex | fabs-function | __future__ | type-conversion | method | heap-memory | conversion | rollback | map-function | zip | recursion | input-function | identity-operator | object-attribute | match | arithmetic-expression | formal-and-actual-parameter | yield | turtle | center | mutable | min-max-function | integer | indexing | syntax-error | multiple-inheritance | generators | syntax | class-and-object | while-and-for-loop | built-in-function | python | update | datatype | data-type | list-comprehension | operator-or | list-join | init | file-handling | pickling-&-unpickling | sys | encoding | immutable-data-type | escape-operator | indentation | regular-expression | global | boolean | counter-function | append | choice | __init_subclass__ | loop | dictionary | oop | head-and-tail | slicing | namedtuple | inherit | range | matrix-list-comprehension | lambdas | built-in-function | multiprocessing | min-function | file_handling | classes | implementation | version-check | numpy | lists | control-flow | join | datetime | data-structures | operator | static-method | docstring | variable | functional-programming | with-statement | frozenset | exponentiation | binary-operation | control-statement | installation | memory-management | numeric | syntaxerror | assert | tuple | oops | while-else-loop | operator-and | staticmethod | statement | mathematics | global-variable | matplotlib | design-principle | precedence-and-associativity | print-statement | mapping-function | control-flow | type-conversion | sorting | complex-number | bitwise-operator | magic-method | exception-handling | dictionaries | string-concatenation | counter | lambda | data-structure | class-and-inheritance | expression | attribute | functions | decimal | basic | string-manipulation | odd-number | sum-function | identity-operator | library | slice | overflow | conditional-statement | multithreading | exception | string-iteration | python-repl | list-indexing | descriptors | call | command-line-parsing | type_conversion | function-argument | function-and-scope | global-variable | thread | enumerate() | print | random-function | operations | data_structure | raise | complex | factorial-function | immutability | binary | interpreter | max-min | while-loop | gil | collections | file | logical-operator | floating-point-precision | file-handling | array | sys-module | for | operand | namespace | loop-control | zfill-function | conditional-statement | version | bitwise-operator | zip-function | pep | objects | __all__-attribute | expand-tab | scientific-notation | tuple-unpacking | string-slicing | encapsulation | list-comprehension | stack | filter | typeerror | iterator | class | methods | boolean-and-non-boolean | math | access-modifier | python-module | collection | touples | assignment-operator | goto-function | generator | logical-operator | filter-function | comparison | asyncio-module | invalid-list | dicts | error-handling | list | def | async | input-function | list-mutation | shallow-copy | format | copy | virtual-environment | constructor | int | nested-loop | comment | syntax-error | python_version ...