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