last day (15 days later) » 

20:45
Hello.
@GeorgeEdison Hi! I need help with a python application and maybe you can help me. Can you?
I can certainly try.
What type of help do you need?
I need a global variable of boolean type, and then change it state (TRUE -> FALSE and vice versa) but I don't know how to call this boolean from a private funtion (if it call like that)
state = True

def some_method():
    global state
    state = False
Like that?
Yes
20:53
The global keyword provides access to global variables.
I don't know what sintaxis I should write in the DEF function
Ahh..
So for example if you had three global variables like so:
a, b, c = 1, 2, 3
You could access them in a method using:
In C I do: void funct_name(int var_name){} But python is uncharted
def some_method():
    global a, b, c
@Lucio Right - functions in C always have access to global variables.
To access a global variable in Python, you must "import" the variable into the current scope.
What I was doing was:
global name
name = True
def function:
if name: ...
Ahhh, ok.. I was doing it the other way around
I'm trying right now. Lets see...
21:15
@GeorgeEdison Thanks!! It works. Now the code is:
def create(self):
global varName
if varName:
#sentences
else:
#sentences

main()
global varName
varName = True
21:43
You're welcome.

last day (15 days later) »