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