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