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