Level 10 : what is the output for the below code?


def outer_function(x):
    def inner_function(y):
        return x + y
    return inner_function

closure = outer_function(10)
result = closure(5)
print(result)

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