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