Ad
  • Custom User Avatar

    Note: encoding can be done with

    def encoding(sample_string):
        binary = ' '.join(map(bin, bytearray(sample_string, encoding='utf-8')))
        return binary
    
  • Custom User Avatar

    This is the third time I've seen this kata in the past few days. Just so you're aware, the reason why it keeps getting retired is because it's receiving too many negative votes. This could be for a number of reasons, such as it lacks novelty, it's a duplicate, it has too many issues, it lacks random tests, the quality is poor, etc. Try not to take it personally, but this is almost guaranteed to be retired again. I suggest coming up with a different idea for a kata. For reference, all of the kata I've created, except for one have made it beyond beta. Some people are just better at creating katas than others.

  • Custom User Avatar

    explanation:
    Calls printf c function

  • Custom User Avatar

    Sorry, I don't really follow--in the other kata, more than one pair can be the solution. In yours, the return value requires slightly more specific bookkeeping, but that's immaterial to the main algorithm--summing the indices is a superficial difference.

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    This was marked as resolved, but the name is still camelCase.

    Actually, the adjustments throughout the thread appear to only have been applied to submission tests, not sample tests, which still use 6969 as a flag for "not found".

    Returning -1 isn't great, either, since there's no reason the algorithm shouldn't work on negative numbers. Better to raise or return None.

  • Custom User Avatar

    Sorry I have fixed the issue

  • Custom User Avatar

    Sometimes this happen in the random tests:

    Unexpected exception raised
    Traceback (most recent call last):
      File "/workspace/default/.venv/lib/python3.11/site-packages/codewars_test/test_framework.py", line 112, in wrapper
        func()
      File "/workspace/default/tests.py", line 36, in _
        list = random.sample(range(lower_range, upper_range), num_of_elements_in_list)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/random.py", line 453, in sample
        raise ValueError("Sample larger than population or is negative")
    ValueError: Sample larger than population or is negative
    
  • Custom User Avatar

    Alright I have changed it to -1, thanks for your time and help.

  • Custom User Avatar

    What don't you know? Pick two random numbers in the array?

  • Custom User Avatar

    Unfortunately I don't know how to do that and have some -6969's at the same time, this works better for me.

  • Custom User Avatar

    It actually does because katas are supposed to follow good practices of their languages. -6969 doesn't make sense.

  • Custom User Avatar

    Also it doesn't matter, it can be any negative number

  • Loading more items...