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