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