About 52 results
Open links in new tab
  1. How can I use a global variable in a function? - Stack Overflow

    Jul 11, 2016 · How do I create or use a global variable inside a function? How do I use a global variable that was defined in one function inside other functions? Failing to use the global keyword where …

  2. How to declare a global variable in Python correctly

    Jan 28, 2023 · I have the following piece of code that presented below with tic-tac-toe implementation. As far as I understand variable "player" is global one and it's value 'X' should be …

  3. Correct Use Of Global Variables In Python 3 - Stack Overflow

    Which is the correct use of global variables in Python 3?: 1) Stating global VAR_NAME once in the core script (not within a function) and then simply referring to the variable as VAR_NAME everywhere

  4. Python function global variables? - Stack Overflow

    Within a Python scope, any assignment to a variable not already declared within that scope creates a new local variable unless that variable is declared earlier in the function as referring to a globally …

  5. Crear variables globales en Python - Stack Overflow en español

    Jul 19, 2019 · Yo soy bastante nuevo con la sintaxis de Python en particular como crear global, nonlocal y local variables y como declararlas sin errores de sintaxis. Por ejemplo en el programo siguiente, …

  6. How to set a global variable in Python - Stack Overflow

    Ok, so I've been looking around for around 40 minutes for how to set a global variable on Python, and all the results I got were complicated and advanced questions and more so answers. I'm trying t...

  7. python - Using global variables between files? - Stack Overflow

    You can think of Python global variables as "module" variables - and as such they are much more useful than the traditional "global variables" from C. A global variable is actually defined in a module's …

  8. Python - Easiest way to define multiple global variables

    Dec 6, 2016 · The reason for this is that python treats classes as modules, so this works out well for setting up a list of global variables- such as when trying to make an interface with multiple options …

  9. How do I use global variables in python functions? [duplicate]

    Jul 12, 2017 · A normal variable is only usable inside of a function, a global variable can be called for outside the function, but don't use this if you don't need to, it can create errors and big programming …

  10. How can I access global variable inside class in Python

    May 30, 2012 · How can I access global variable inside class in Python Asked 13 years, 6 months ago Modified 22 days ago Viewed 286k times