Level 5 : What will this print?


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

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