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