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