Level 9 : Read the following Python code carefully and point out the global variables?


y, z = 1, 2
def f():
    global x
    x = y+z

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