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.
Agreed, and Not!! just like the kata
I have no idea what you are talking about.
ty
you were right!
i did change now my old version, thx to you're comment.
just by moving the ships variable into the function and use "global ships" its now a working solution too. and pretty similar to my code with the class
@JimmyKnox2058 - I can't see your old solution, since you have submitted your new one, but it sounds like you were using global variables in your code. This is a common mistake that will cause you to fail, you can read about it in the Troubleshooting guide here
TLDR; don't use global variables in your kata solutions as they will not update between tests
yes. i ran into the same problem. there is something wrong with the random tests for Python.
solution:
changed functions based code into class
a class always makes a new instance for all atributes (variables), this solved the issue and passed it!
after long long time looking whats wrong with my code...
looks like the random tests do not clear all data and keep randomly data from the previous test...
Read this: https://docs.codewars.com/training/troubleshooting/#works-but-no and see if it helps.
Well, you should print the input, and then you should be able to prove why it should be True or False for any random test. Pick any example.
I haven't solved this in python, so I cannot see what testing method is used for random tests, but it is possible that the tests run your function first (in which you can mutate the original array) and then the reference solution is run with the same (possibly modified) array. This means you can get flawed results.
Edit: late reply :(
Check you're not mutating the input.