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


x=100
def f1():
    global x
    x=90
def f2():
    global x
    x=80
print(x)

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