Level 9 : What is the output?


x = 10
def outer():
    x = 5
    def inner():
        nonlocal x
        x += 1
        return x
    return inner()

print(outer())

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