That's correct, problem is with delaysteps, you need to do boundchecking for an array.

IndexError: list index out of range, this error signifies that you are trying to access an element of an list which does not exist or say out or list range.