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