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