Level 1 : What does the following code print?


def make_multiplier(n):
    return lambda x: x * n

double = make_multiplier(2)
triple = make_multiplier(3)

print(double(5), triple(5))

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