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.
If we are supposed to write random_valid_key() and random_invalid_key(), then the kata description should specify that. But that doesn't make sense because we can then write trivial implementations of those functions that will make any solution pass.
In this case, the "random_valid_key" function will need to calculate 43 numeric digits plus 1 check digit. Try using another function within the code to create the check digit and import it into the "calculate_check_digit" function. As I mentioned, I tested the code on Kate and it works without any errors. As for the "random_invalid_key" function, you need to create a key that does not have the check digit in which case it will always return false, if a valid key is generated it will not pass Kata.
Would you please refrain from posting AI-generated answers all over the place, including Github and kata discourses? They are borderline off-topic, and none of them answered any question in a useful way. Just write your own answer, keep it on topic, and eventually use AI tools for proofreading and spellchecking.
And the problem with
random_valid_key
andrandom_invalid_key
is in your code and if you cannot see it, no AI will help you understand it.Still seeing it though. Here is what it looks like when I submit a solution:
I tested Kata, and it doesn't show any errors
Time: 517ms Passed: 4Failed: 0
Test Results:
Access Key Validation Tests
Test valid access key
Test invalid access key
Test list of access keys
(2 of 2 Assertions)
Completed in 0.32ms
You have passed all of the tests! :)
Function scope: Make sure the random_valid_key function is in the correct scope to be accessed within tests.
Check that the code indentation is correct. In Python, incorrect indentation can cause problems with function scoping. For example, if the random_valid_key function definition is inside another function or conditional block, it may not be globally accessible.
random_valid_key after tests: The random_valid_key function must be defined before being called in tests. If the function definition code comes after the test block, Python will not find the function at execution time. To fix this, ensure that the random_valid_key definition is above the test call or within the same code block where it is invoked.
Still an issue.
No random tests
Thanks for the information. Kata has been corrected
random_valid_key
andrandom_invalid_key
are missing from the testsNot an issue, just a spoiler.
And why is this an issue? Please, don't post solutions like that again, you just spoil the kata.
This comment is hidden because it contains spoiler information about the solution
I found the kata interesting, but I agree that the explanation could be clearer. I spent a lot of time trying to interpret the logic behind the examples and the relationship between cuts and red cubes. Perhaps including a more detailed visual representation or reviewing the description would be very helpful to avoid confusion, especially for those just starting out. However, I enjoyed the challenge of finding a solution! For those who are still stuck, my tip is: visualize the problem in 3D, this helped a lot in my case. 😊