Level 1 : What is the output of the following code?


def func(nums):
    return (n * n for n in nums if n % 2 == 0)

nums = [1, 2, 3, 4, 5]
gen = func(nums)
print(list(gen))

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