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


l1=[1,2,3]
l2=[4,5,6]
[x*y for x in l1 for y in l2]

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