Ad
  • Default User Avatar

    I think you missed the important bit: CONVERSION_RATES is hard-coded in the specification.

    The information about consonants and vowels isn't disregarded. It's combined with the given CONVERSION_RATES to discover that all the exchange rates consisting of only zeros and ones are, in fact, binary. At that point it isn't necessary for the code to check for consonants or vowels.

  • Default User Avatar

    CONVERSION_RATES is hard-coded in the specification (not just the tests), so this is a valid solution as the kata is written.

    Whether that means it is best practice is debatable. On the one hand, generalized solutions are nice. On the other hand, quick-and-dirty one-off scripts are also nice. (When is the 'you' character going to go on vacation again and have this exact thing happen?)

    Then we can get a little meta about it: How does the 'you' character know that the starting letter determines whether the rate is in decimal or binary? My guess is he doesn't. He's just pattern matching, but the apparent pattern might be false.

    Cheers. :D

  • Custom User Avatar
  • Custom User Avatar

    I fixed the rotn problem.

    decode accepts a string and returns a list as shown in the examples.

  • Default User Avatar

    Thanks for your input! I've changed the function name to lower case and modified the list of things that should not be shifted (it's at the bottom of the description).

  • Custom User Avatar

    I changed the description and added other test cases.

  • Custom User Avatar

    The problem is that s is only composed of characters from the alphabet, but string can consist of numbers as well (it says in the description: "a palindrome is a word, phrase, number, or other sequence of symbols or elements..."). So if you change c.isaplha() to c.isalnum() it should work.

    I added an example test case that includes numbers to clarify that string can have numbers. Thanks for pointing that out!