Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
updated. Should be good now.
Don't forget to copy your code and then reset the trainer.
most likely means that your function is returning None in some cases (when it shouldn't), and that the testing function should be updated to handle that more gracefully.
ofc i googled error before leaving comment and ofc i tried to debug it.
The None variable is placed somewhere in checking function.
I just dont have variables with names that are in the error output.
If you Google (other search engines are available, this is not an endorsement) the exact phrase: "TypeError: 'NoneType' object is not subscriptable" you will find the answer to your question.
Basically you are trying to are trying to access the index of something that has a
None
value; check the first few Google results to see how this can happen.If you want to troubleshoot you can add a print statement
print(my_variable)
for the different steps of your code to see where aNone
value is getting returned.My code is ok for most of the cases, but in some cases it gives output like this:
Traceback (most recent call last):
File "/workspace/default/.venv/lib/python3.10/site-packages/codewars_test/test_framework.py", line 112, in wrapper
func()
File "/workspace/default/tests.py", line 30, in _
test.assert_equals(is_cycle(find_cycle(a,b),a,b), exp,msg)
File "/workspace/default/tests.py", line 10, in is_cycle
return path[0] == path[-1] and len(set(path)) == a*b and all((abs(pos_2[0]-pos_1[0]),abs(pos_2[1]-pos_1[1])) in moves and
TypeError: 'NoneType' object is not subscriptable
Isn`t it a mistake in the checking?
Cool!