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