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.
That makes a lot of sense. Thank you so much!
Check out the Python docs, especially the "Important warning!"
Thank you so much. Could you explain more as to why the
prev = [(0,0)]
part intrudces a subtle bug? Does it have something to do with how it is stored in global environment as opposed to local one within each iteration of recursion? And why don't I see the same problem with other parameters: i.e.,x=0, y=0
?Change the last lines of your code to this:
You can run it in https://programiz.pro/ide/python and you will see how your function returns
False
twice, while the second input should result inTrue
.It really does not. It's problem with the tests you do in other interpreters. Your tests are incomplete.
Codewars uses exactly the same Python as other places, you just perform your tests incorrectly. The
prev = [(0,0)]
part in your function introduces a subtle bug which does not manifest in other environments because your tests are incomplete. Try running your solution twice in any other place and you will notice the same problem.Your solution has a bug, it's not a problem with Codewars' Python.
This comment is hidden because it contains spoiler information about the solution