Level 10 : What will be the output of the following code?


def outer():
    x = 10
    def inner():
        print(x)
    return inner

fn = outer()
fn()

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