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