Ad
  • Custom User Avatar

    Please read the docs in the detailed answer provided to your previous "gripe" with this kata. If your code submissions passes, you'll have a solution to view (which you currently do not).

    There is nothing missing from the description, examples, or test cases that would prevent you from being able to complete this kata.

    Best of luck.

  • Custom User Avatar

    This kata is misleading in yet another way. The way that I usually approach these is to run the examples, and if the examples pass, then I submit an "attempt". But in this case, "Run examples" apparently always says that your code fails. This is my output:

    Time: 417ms Passed: 0 Failed: 1

    Since I couldn't figure out what was wrong with my code, I submitted anyway, and it passed.

  • Custom User Avatar

    But the instructions say that under certain circumstances, the value of the area should be the string "Fizz" or "Buzz" or "FizzBuzz". Those are not numbers from 1 to 100. My question about default values is that the instructions don't say what the arguments are used for. They only say what the function is supposed to do if there are no arguments.

    Here's what I think you're asking for:
    fizzBuzzCustom(stringOne, stringTwo, numOne, numTwo) returns the result of starting with the array [1, 2, ..., 100], and replacing each number in the array by stringOne if it is divisible by numOne (but not divisible by numTwo), replacing it by stringTwo if it is divisible by numTwo (but not numOne), and replacing it by the concatenation of stringOne and stringTwo if it's divisible by both. If a number in the array is divisible by neither numOne nor numTwo, leave it unchanged.

    If fewer than 4 arguments are supplied, use the default values of "Fizz" for stringOne, "Buzz" for stringTWo, 3 for numOne and 5 for numTwo.

  • Custom User Avatar

    When I first wrote this, I probably listened to more feedback than I should have.

    Q: Does that mean an array of length 100? Or does it mean an array whose elements are numbers from 1 to 100?
    A: I believe this at one point said, "an array whose elements are numbers from 1 to 100."

    Q: What does "the index of the array for the number" mean? I assume it just means that if x is the array, then x[i] should be equal to 'Fizz' if i is divisible by 3, etc. But the examples don't show that. It seems to show that if i+1 is divisible by 3, ...
    A: If the number in the returned array is divisible by n.

    Q: I'm not sure what it means to use defaults for the values.
    A: The Mozilla Developer Network has some nice documents explaining default arguments (parameters)

    Q: So are we supposed to write our own test?
    A: If you'd like to test, yes. There are docs for CodeWars testing.

    Q: I have no idea what the program is supposed to do, so how could I possibly write a test to see if it does it correctly?
    A: All the required information is included in the description and the examples. I suggest focusing on the examples, as they explicitly state exactly what the program should do.

    Try not to get frustrated. Perhaps try the original FizzBuzz kata first, then come back to this one.

    Please let me know if you have any further questions.

  • Custom User Avatar

    I found the instructions for this challenge to be completely confusing. It wasn't at all clear what was being asked for. For example:

    "Create a method/function that returns an array of numbers from 1 to 100."

    Does that mean an array of length 100? Or does it mean an array whose elements are numbers from 1 to 100?

    For another example, the instructions say:
    "If no arguments are passed, the value at the index of the array for the number should be 'Fizz' if it is divisible by 3, 'Buzz' if divisible by 5, 'FizzBuzz' if it divisible by both 3 and 5, or the number if it is not divisible by 3 or 5."

    What does "the index of the array for the number" mean? I assume it just means that if x is the array, then x[i] should be equal to 'Fizz' if i is divisible by 3, etc. But the examples don't show that. It seems to show that if i+1 is divisible by 3, ...

    For another example, the instructions don't actually say what is supposed to be done with the arguments. The instructions say: "If no arguments are passed, ...", but it doesn't say what to do with the arguments if they are passed. The instructions say "The first and second arguments are strings, which should be 'Fizz' and 'Buzz' by default. The third and fourth arguments are integers and and should be 3 and 5 by default." But there is no indication of how to use the arguments, so I'm not sure what it means to use defaults for the values.

    Finally, the test that is performed when you click "Run Examples" doesn't actually do anything. So are we supposed to write our own test? I have no idea what the program is supposed to do, so how could I possibly write a test to see if it does it correctly?

    Is this challenge supposed to be preparation for a job as a programmer, when you often have no idea what the customer actually wants?

  • Custom User Avatar

    Hi, I'm sorry for overreacting. It seems that it was a temporary problem.

    The symptom was that when I went to "View Profile", then selected "Kata", then selected this challenge, "Musical Pitch Classes", then selected "Solutions", then selected "My Solutions", the result was a message saying "No Soluions Submitted". Which was not true.

    The same thing happened with several other challenges, including "Create Phone Number" and "Find Count of Most Frequent Item in an Array".

    All of these challenges now show the solutions I submitted. Is there a delay between clicking "Submit Final" and the solution appearing in my profile?

  • Custom User Avatar

    Thanks for letting us know Daryl. We're going to take a look into this for to see what happened for you. If you have details that can help us reproduce it please send us an email at info@codewars.com. In the future you can contact us there instead of on a kata and we'll get it much faster (even if we don't get to respond).

  • Custom User Avatar

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