Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Thanks for the information. Kata has been corrected

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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. 😊