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