Level 5 : What is the output?


a = [1, 2, 3]
b = (x*x for x in a)
a.append(4)
print(list(b))

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