Python makes unexpected selection

Dear Friends:

Please help a novice. I am trying to use Blender to simulate a Rubik’s Cube. So far I have made functions to make move like Left Face Clockwise etc. but I am stumped by the code to select the cubes between the front and back faces. The attached blender file will show that the first two functions (in the text editor) work properly but the function su() behaves in an unexpected manner. What am I doing wrong?



Rubik’s Cube v006a.blend (654 KB)