Ad
  • Custom User Avatar

    Serves me right :D
    Thanks for the reply.

  • Custom User Avatar

    I have solved a kata in language C, but the rank did not increase. Is it because I had already solved it in language A, or because I translated it to language B, or a combination of the two?

  • Custom User Avatar

    Python

    I enjoyed this kata.

  • Custom User Avatar

    Python

    I enjoyed this kata.

  • Custom User Avatar

    Python: A fun kata. My solution is a bit long winded, but easy to understand, I believe.

  • Custom User Avatar

    Python: enjoyed it, but I wrote some of the ugliest code ever.

  • Custom User Avatar

    Nice kata. I am learning Python, and this taught me a few ways to write faster code.

  • Custom User Avatar

    I have enjoyed this kata.

    Once, when running the "attempt", I got

    Traceback (most recent call last):
      File "main.py", line 37, in <module>
        y = randrange(x + 2, 500)
      File "/usr/local/lib/python3.6/random.py", line 199, in randrange
        raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
    ValueError: empty range for randrange() (501,500, -1)    
    

    Hope this helps.

  • Custom User Avatar

    the easiest kata ever :)

  • Custom User Avatar
  • Custom User Avatar

    That's a good point, thank you. Description amended.

  • Custom User Avatar

    Your objection seems reasonable. I can see how especially non-native speakers might have trouble with this. I will amend asap.
    Thank you for the feedback.

  • Custom User Avatar

    Who cares about cheating? The description of this kata has a link to a page with solutions:
    https://www.codewars.com/kata/integer-to-nested-structure

  • Custom User Avatar

    I think there is a discrepancy between the encoding algorithm and the sample provided. Let's look at the algorithm:

    Given positive integer n > 1. We convert it to an array as follows:

    1. If it is equal to 2 convert to an empty array
    2. Otherwise create array of all of n's prime factors, sorted ascending
    3. Replace each element with its index in prime numbers sequence
    4. For each element in array go to step 1

    The example you give is n = 46. Let's do this step by step:

    1. Is 46 = 2? No, go to step 2.                                         46
    2. Array of prime factors (ascending):                                  [2.23]
    3. Replace elements with their index in prime number sequence:          [1,9]
    4. Convert 1 and convert 9. 
      1: We can't convert 1, as it is not > 1. Let's convert it to "?"      [?,9]
      9: 9 is not equal to 2, so create array of prime factors:             [?,[3,3]]
         Replace elements with index:                                       [?,[2,2]]
         Back to step 1: Convert the two 2s                                 [?,[[],[]]]
    

    This doesn't look like what you give in your example, even when I magically replace the ? with []:

    [?,  [[],   []]]     vs.	   
    [[], [[[]], [[]]]]	   
    

    Either the description is wrong, or the example.
    (Or I am wrong. That's always a possibility of course.)

  • Custom User Avatar

    I never got any honour for referrals. So I have some doubt if this actually works.

  • Loading more items...