Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.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
aha!
I fixed the rotn problem.
decode accepts a string and returns a list as shown in the examples.
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).
I changed the description and added other test cases.
The problem is that
s
is only composed of characters from the alphabet, butstring
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 changec.isaplha()
toc.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!