Ask coding questions

← Back to all posts
NoneType
KENNETHTRIPP (50)

There seems to be something wrong with the move_u() function, but I can't figure out what. Can someone help me.
Here's the error:

Traceback (most recent call last):
  File "main.py", line 24, in <module>
    cb.print_cube(cube)
  File "/home/runner/Rubiks-Cube/cube.py", line 5, in print_cube
    for i in range(len(cube[0])):
TypeError: 'NoneType' object is not subscriptable

Also, it works just fine with move_r()

Comments
hotnewtop
heyitsmarcus (342)

You're going to want to slap me or yourself whenever you see this, but all you're missing is a return cube at the very bottom of your move_u function so that it can return what you've modified back to the calling script haha I added that, and it ran great! :)

It's one of those "can't see the forest through the trees" things where you need another pair of eyes to look at something.

Cheers!