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