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