Ad
  • Default User Avatar

    "A lot of these questions are made intentially vague or weirdly worded to increase difficulty and to make you think a little more". No, it's called bad English. We come here to test our ability to think programmatically, not to try and improve our ability to interpret poorly written text.

  • Default User Avatar

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

  • Custom User Avatar

    study on what self does, and how instances of classes work

    class RandomClass():
      def __init__(self, INPUT1, INPUT2, etc..):
        self.INPUT1 = INPUT1   # this takes the inputs and makes them part of the class..
        self.INPUT2 = INPUT2
        self.hiddendata = ["data", "accessed", "by", "entire", "class"] # data that is inate to the class
        
      def add(self, input1, input2):     #self here as well. so you can access self.hiddendata for example
        return self.hiddendata, input1 + input2
    

    there is only 1 object tested. example:

    x = Arith("five")
    print(x.add("seven"))
    this should return "twelve"

  • Custom User Avatar

    Please specify the language you are using?

  • Default User Avatar

    Hi iphark. For this particular kata, research "lookahead assertion", "character set", and how the ^ (carat) and $ (dollar sign) work in regex. Hopefully this helped!

  • Default User Avatar

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

  • Custom User Avatar

    No, I stared at this for a solid 5 minutes before I understood what the author wanted. A lot of these questions are made intentially vague or weirdly worded to increase difficulty and to make you think a little more.

  • Custom User Avatar

    That is an issue of the Kata and not your code - look below at other comments which point out this issue.

    However, this issue is only on the example testcases and not the real testcases. The example testcases are just examples of what the testcases look like. You do not need to pass these tests to submit your solution. This means you can just click the "Attempt" button instead of the "Run Examples" button.

  • Custom User Avatar

    Read the description fully. It states that if v is ommited, fill the array with undefined, which means that the testcases may call the function without the parameter v. It gives the error because you are stating that v will be the second parameter, however this parameter is omitted.

    I suggesting looking at default parameter values, where a default value is given to the parameter if it is omitted.

  • Custom User Avatar

    In the random tests smiley faces are generated randomly. You can print out the input arr and see your mistake with print/echo/console.log depending on what language you are using.