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