• Bug in check_solution

Question related to mission Express Delivery

 

This was a great mission. I found a bug in `check_solution` (line 45 in initial code), the last comparison clearly should be `n_col >= max_col`.

if 0 > n_row or n_row >= max_row or 0 > n_col or n_row >= max_col:

Although I suggest to flip the order and do the much more readable and error proof:

if not 0 <= n_row < max_row or not 0 <= n_col < max_col:

This wasn't triggered for the standard examples because many are square, or at least not higher than wide. To recreate the problem use the following and maybe add it as a test.

assert check_solution(checkio, 11, list('SB....BE'))
38