Ad
  • Default User Avatar

    You do not need the 'return' for Ruby in this case, though. The == operator will always give a return value of true or false.

  • Custom User Avatar

    Oh okay. My bad, I didn't read the instructions well enough.

  • Custom User Avatar

    Yes it should. Because the Kata specifically asks that the result should be sorted.

    The items in the returned array should be sorted alphabetically, with numbers before strings.

  • Custom User Avatar

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

  • Custom User Avatar

    I printed the 'char_to_morse_dict' and noticed there is no difference between the values of uppercase and lowercase keys.
    It seems kind of unnecessary since it is simple to call lower() or upper() on 'string'.

    I think the name of the dict should be shortened to 'CODE_TO_MORSE'.
    It seems repetitive and obvious to include '_dict' at the end.
    The reason I have capitalized the dict's name is because of PEP8.

    "Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL."

    Based on my suggestions:

    CHAR_TO_MORSE = {
        '0': '-----', '1': '.----', '2': '..---', '3': '...--',
        '4': '....-', '5': '.....', '6': '-....', '7': '--...',
        '8': '---..', '9': '----.', 'a': '.-', 'b': '-...',
        'c': '-.-.', 'd': '-..', 'e': '.', 'f': '..-.',
        'g': '--.', 'h': '....', 'i': '..', 'j': '.---',
        'k': '-.-', 'l': '.-..', 'm': '--', 'n': '-.',
        'o': '---', 'p': '.--.', 'q': '--.-', 'r': '.-.',
        's': '...', 't': '-', 'u': '..-', 'v': '...-',
        'w': '.--', 'x': '-..-', 'y': '-.--', 'z': '--..'}
    
  • Custom User Avatar

    It's called: CHAR_TO_MORSE

    and it's written within the initial solution -->

    Javascript: //CHAR_TO_MORSE preloaded to convert characters into Morse code.
    Ruby: #$CHAR_TO_MORSE preloaded to convert characters into Morse code
    Pyhton: #CHAR_TO_MORSE preloaded to convert characters into Morse code

  • Custom User Avatar

    Can't figure out what the dictionary name is called.

  • Default User Avatar

    Doesn't specify that you must return only the boolean, makes it seem like you need to return a string saying why it can't be divided by x or y

  • Custom User Avatar

    You should provide some test cases.

  • Custom User Avatar

    In the C# one it returns Boolean, which is not a default type. It should return bool.

  • Custom User Avatar

    Sorry, that's not quite what we were expecting! - Expected:

    [9801,970299,96059601,9509900499,941480149401,93206534790699,9227446944279200,913517247483640800,90438207500880450000,8.953382542587164e+21,8.863848717161292e+23,8.77521022998968e+25,8.687458127689782e+27,8.600583546412884e+29,8.514577710948754e+31,8.429431933839267e+33,8.345137614500874e+35,8.261686238355865e+37,8.179069375972306e+39,8.097278682212584e+41,8.016305895390458e+43,7.936142836436554e+45,7.856781408072188e+47,7.778213593991466e+49,7.700431458051552e+51,7.623427143471036e+53,7.547192872036325e+55,7.471720943315962e+57,7.397003733882802e+59,7.323033696543975e+61,7.249803359578534e+63,7.177305325982749e+65,7.105532272722922e+67,7.034476949995693e+69,6.964132180495736e+71,6.894490858690778e+73,6.825545950103871e+75,6.757290490602832e+77,6.689717585696803e+79,6.622820409839835e+81,6.556592205741437e+83,6.491026283684022e+85,6.426116020847182e+87,6.36185486063871e+89,6.298236312032322e+91,6.235253948911999e+93,6.172901409422879e+95,6.11117239532865e+97,6.050060671375364e+99,5.989560064661611e+101,5.9296644640149954e+103,5.870367819374846e+105,5.811664141181097e+107,5.7535474997692865e+109,5.696012024771593e+111,5.639051904523877e+113,5.5826613854786385e+115,5.526834771623853e+117,5.471566423907614e+119,5.416850759668538e+121,5.362682252071853e+123,5.309055429551134e+125,5.255964875255623e+127,5.203405226503067e+129,5.151371174238036e+131,5.099857462495656e+133,5.048858887870699e+135,4.998370298991992e+137,4.948386596002071e+139,4.8989027300420505e+141,4.84991370274163e+143,4.8014145657142136e+145,4.753400420057072e+147,4.705866415856501e+149,4.658807751697936e+151,4.6122196741809564e+153,4.566097477439147e+155,4.520436502664755e+157,4.4752321376381076e+159,4.4304798162617267e+161,4.3861750180991093e+163,4.342313267918118e+165,4.298890135238937e+167,4.2559012338865475e+169,4.213342221547682e+171,4.1712087993322055e+173,4.129496711338883e+175,4.088201744225494e+177,4.047319726783239e+179,4.006846529515407e+181,3.9667780642202524e+183,3.92711028357805e+185,3.887839180742269e+187,3.848960788934846e+189,3.810471181045498e+191,3.772366469235042e+193,3.734642804542692e+195,3.6972963764972654e+197,3.6603234127322926e+199] 
    

    instead got:

    [9801,970299,96059601,9509900499,941480149401,93206534790699,9227446944279200,913517247483640800,90438207500880450000,8.953382542587164e+21,8.863848717161292e+23,8.77521022998968e+25,8.687458127689782e+27,8.600583546412884e+29,8.514577710948754e+31,8.429431933839267e+33,8.345137614500874e+35,8.261686238355865e+37,8.179069375972306e+39,8.097278682212584e+41,8.016305895390458e+43,7.936142836436554e+45,7.856781408072188e+47,7.778213593991465e+49,7.70043145805155e+51,7.623427143471035e+53,7.547192872036325e+55,7.471720943315962e+57,7.397003733882802e+59,7.323033696543973e+61,7.249803359578533e+63,7.177305325982748e+65,7.10553227272292e+67,7.03447694999569e+69,6.964132180495735e+71,6.894490858690777e+73,6.825545950103869e+75,6.757290490602831e+77,6.689717585696802e+79,6.622820409839834e+81,6.556592205741436e+83,6.491026283684022e+85,6.42611602084718e+87,6.361854860638708e+89,6.2982363120323215e+91,6.2352539489119985e+93,6.172901409422878e+95,6.111172395328649e+97,6.050060671375362e+99,5.989560064661607e+101,5.929664464014992e+103,5.870367819374843e+105,5.8116641411810945e+107,5.753547499769283e+109,5.69601202477159e+111,5.639051904523873e+113,5.582661385478635e+115,5.526834771623849e+117,5.471566423907611e+119,5.416850759668535e+121,5.362682252071849e+123,5.3090554295511306e+125,5.255964875255618e+127,5.2034052265030625e+129,5.151371174238032e+131,5.099857462495652e+133,5.048858887870695e+135,4.998370298991988e+137,4.948386596002067e+139,4.898902730042048e+141,4.849913702741626e+143,4.8014145657142097e+145,4.753400420057068e+147,4.705866415856498e+149,4.6588077516979325e+151,4.6122196741809535e+153,4.566097477439144e+155,4.5204365026647525e+157,4.4752321376381044e+159,4.4304798162617227e+161,4.3861750180991055e+163,4.342313267918115e+165,4.2988901352389337e+167,4.255901233886544e+169,4.213342221547679e+171,4.1712087993322017e+173,4.1294967113388805e+175,4.088201744225491e+177,4.0473197267832355e+179,4.006846529515403e+181,3.9667780642202496e+183,3.9271102835780473e+185,3.8878391807422666e+187,3.848960788934843e+189,3.810471181045495e+191,3.77236646923504e+193,3.7346428045426895e+195,3.697296376497262e+197,3.66032341273229e+199]
    
  • Custom User Avatar

    I think the JavaScript one needs some default test cases.