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