Level 2 : What is the output of the following code?


nums = [1, 2, 3, 4]
squared_nums = map(lambda x: x**2, nums)
print(list(squared_nums))

Author: IndraD | Tags: lambda | 1736+ Python FAQs | Share
while-and-for-loop | immutability | nested-loop | mysql | classes | operations | invalid-list | print | collection | memory-management | slicing | function | statement | generator | class | iterable | data-structure | comprehension | precedence-and-associativity | split | while-else-loop | virtual-environment | encapsulation | __all__-attribute | exception | async | identifier | asyncio-module | enumerate() | pickling-&-unpickling | memory | identity-operator | feature | string-formatting | file-handling | list-operation | logical-operator | random | range | loops | pseudocode | inherit | list-method | append | sum() | integer | max-min | staticmethod | yield | control-flow | tuple-unpacking | global-variable | string-iteration | touples | control-statement | virtual-environment | access-modifier | expand-tab | exponentiation | syntax-error | lists | inheritance | numeric | file_handling | odd-number | operator-and | join | comment | dictionary | global-keyword | attribute | exception-handling | binary-operation | data-type | built-in-function | python | string-concatenation | math-copysign | parameter | dictionaries | threading | asyncio | numpy | python-repl | postfix | raise | string-method | methods | comparison | sorting | class-and-instance-variable | keyword | mathematics | generators-in-python | dicts | loop-control | method | call | python-history | array | __init_subclass__ | goto-function | update | file | string | oops | math | class-and-inheritance | pandas | function-and-scope | error-handling | sorted | file-handling | string-method | expression | compute | list-comprehension | functional-programming | loop | string-formatting | magic-method | syntaxerror | matrix-list-comprehension | round | data-structure | string-slicing | library | functions | filter | installation | descriptors | center | command-line-parsing | software-design | boolean | lambda | for | objects | assignment-operator | filter-function | list-mutation | escape-operator | default-mutable-argument | zip | built-in-function | condition | format | decimal | copy | version-check | built-in | formal-and-actual-parameter | factorial-function | input-function | recurssion | boolean-and-non-boolean | identity-operator | round-function | regex | fabs-function | name-mangling | deep-copy | basic | overflow | design-principle | gil | id-function | conditional-statement | indexing | lambdas | regular-expression | polymorphism | random-function | tuple | list-join | syntax-error | mapping-function | thread | python-django | stack | context-manager | typeerror | type-conversion | return-statement | function-argument | exception-handling | generators | multithreading | swapping | else-statement | matplotlib | data-structures | min-max-function | datatype | counter | multiprocessing | print-statement | logical-operation | encoding | rollback | arithmetic-operation | conversion | debugging | __future__ | bitwise-operator | interpreter | data_structure | higher-order-function | init | sys | control-flow | benefit | operator-or | list-slicing | package-management | operator-overloading | indentation | variable | docstring | import-method | turtle | destructor | implementation | map-function | collections | error | complex-number | choice | complex | recursion | global | set | list-indexing | version | assert | counter-function | static-method | lambda-function | floating-point-precision | python-module | mathematical-function | oop | int | scientific-notation | zip-function | immutable-data-type | string-slicing | decorator | input-function | binary | datetime | operator | list | shallow-copy | operators | namespace | zfill-function | heap-memory | application | arithmetic-expression | mutable | syntax | sum-function | iterator | matrix | slice | string-manipulation | bitwise | list-vs-tuple | precedence | min-function | global-variable | input | python_version | pep | conditional-statement | frozenset | def | while-loop | class-and-object | set-operation | constructor | bitwise-operator | module | sys-module | data-type | with-statement | type-conversion | list-comprehension | match | object-attribute | logical-operator | operand | multiple-inheritance | namedtuple | head-and-tail | type_conversion ...