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