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