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