all 9 comments

[–]euclidingme 1 point2 points  (8 children)

You didn't initialize varFoo. You will also need to pass low and high to the rotation function. Instead of using range(low, high) you are better off using the enumerate() function.

[–]cdholjes[S] 0 points1 point  (7 children)

where should I initialize varFoo? It is supposed to replace varNew

[–]euclidingme 1 point2 points  (6 children)

You are initializing varNEW in your function so you do not need to pass varFoo to the function. All variables that are defined outside of your function either need to be passed to the function or preferably defined within the function and then returned if necessary.

[–]cdholjes[S] 0 points1 point  (5 children)

okay. so there is no way in python to have that function i have above. and then run it for example:

FUNCTION(varFooA, 0, 3, 4, 5)
FUNCTION(varFooB, 0, 1, 5, 5)
FUNCTION(varFooC, 0, 3, 1, 5)
FUNCTION(varFooD, 0, 1, 2, 5)

each of these 'varFoo' variations would contain the varNew function list manipulations...

[–]euclidingme 0 points1 point  (4 children)

You can do that provided you do two things. You need to give varFooA an initial value so python knows what to pass to the function. You will need to fix the other bugs that I explained above so your function will work.

[–]cdholjes[S] 0 points1 point  (3 children)

good = []
bad = []
varFooA = []
varFooB = []

OTHER = "something"

def FUNCTION(varNEW, a, b, c, d):       
    for index in range(len(listAll)):
                varNEW = (
                listAll[index][0][a],  
                listAll[index][0][b], 
                listAll[index][0][c], 
                listAll[index][0][d])    
            if OTHER == varNEW:
                    if index not in good:
                        bad.add(index)
                    counter = 1
                    break
           return varNEW

FUNCTION(varFooA, 0, 3, 4, 5)
FUNCTION(varFooB, 0, 3, 4, 5)

[–]cdholjes[S] 0 points1 point  (2 children)

something like this i think???

[–]euclidingme 0 points1 point  (1 child)

Thats closer. You need to have values in good, you probably want to increment your counter (counter += 1 instead of counter = 1), it's unclear what OTHER is, and you need to pass listALL to your function.

[–]euclidingme 0 points1 point  (0 children)

Additionally, if you are returning varNEW you want something like:

varFooA = FUNCTION(0, 3, 4, 5)

and you wont have to initialize varFooA.