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