Ad
  • Default User Avatar

    Instead of saying - 1 * (expression), you could say - (expression), as boolean values are interpreted as 1 or 0 in arithmetic, and you can subtract those as well like you can do with (almost) any value.

  • Default User Avatar

    I agree. I think most people (including myself) approached the problem as if a number in the array had to be divisible by its index, but this doesn't work correctly for index zero as we cannot divide by zero. However, as you suggested, zero is a multiple of every number, including itself. I agree that if zero appears at the zeroth index it is a valid multiple and should probably be included.

  • Default User Avatar

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

  • Default User Avatar

    Try printing the input. Then you can see what inputs cause your code to fail and debug it from there.

  • Default User Avatar

    It means you have given a word that the kata writer does not consider to be in the input. The most likely explanation is that you have split a word where the writer did not want you to (e.g. splitting "wor'd" into "wor" and "d") or you have joined two or more words that the kata writer considered to be separate. Try printing the input immediately and you should get a better idea what the random tests are like. Only apostrophes can be used to connect letters together into one word.

  • Default User Avatar

    There is currently an example of this in python: one of the test cases has 'CodeWars is nice' as the input with the expected result '#CodewarsIsNice'. When this test is failed the message 'Should capitalize all letters of words - all lower case but the first.' is given.

  • Default User Avatar

    Tax is a rate you must pay as a percentage of your earnings. Your invested savings themselves are not included in the tax calculation, only the earnings made from the interest. If, in a given year, you earn $100, a tax rate of 20% (0.2) would mean $20 must be paid as tax. Your invested savings would increase by $80 that year.

  • Default User Avatar

    For anybody still wondering what behaviour the kata requires for apostrophes or hyphenation: hyphenated words should be broken up into two separate words (e.g. "three-quarters" becomes "three quarters").

    Apostrophes are treated as letters iff they are beside actual letters, or other apostrophes that are. Apostrophes alone do not form a word.

    ''h'el''lo is a considered word, while ''' is not

  • Custom User Avatar

    yeah, this frustrated me for a bit because the solution I wrote seemed to work fine in the console but would not work in codewars. I guess I should have paid more attention and ran the equations as they were written with the extra space!

  • Custom User Avatar

    JavaScript as well

  • Default User Avatar

    I noticed a small potential issue in the python random tests. Inputs are given with a space " " as the final character in the string, which I would not have expected based on the description, examples or fixed tests.

  • Default User Avatar

    I think there is still a bug that means it fails a small number of cases. I suspect there are very specific circumstances where a bug in the code breaks the method. While trying to understand what these circumstances were, a test ran without any examples of the cases that break the method and I accidentally submitted. This is also why my debugging print statements are also present.

  • Custom User Avatar

    Closing then.

  • Default User Avatar

    I think it is clearer now. Thanks.

  • Custom User Avatar
  • Loading more items...