7 kyu

Colored Hexes!

288 of 583Caders
Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • QKiryu Avatar
  • Unnamed Avatar

    Python: fixed tests only have numbers padded to 3 digits, but there are 2- and 1-digit numbers in the random tests.

  • nsticco Avatar

    This comment has been hidden.

  • ZozoFouchtra Avatar

    This comment has been hidden.

  • zebulan Avatar

    @Caders,

    I made a few minor updates to your kata.

    • I submitted my original solution and then realized I didn't account for the empty string... but it still passed the tests
      • I added a test for an empty string as input, along with a few more basic tests so that there was at least one per color.
    • In your random tests, you used concatenation ('..' + '..' + '..') but it is better to use str.join when there are more than two strings to add together
      • Because strings are immutable in Python, a new string is made for each concatenation
      • If you use str.join, it will just create a single string
    • It's a good habit to have the Basic Tests in the Example Test Cases section AND put them in the main Test Cases section as well
    • I switched the random test.assert_equals so it matches the order (actual, expected)
    • I added two missing 0's to the first example in the description (to match your other examples so that each number has 3 digits)

    Hopefully you don't mind the changes!

    • Caders Avatar

      Haha, that's a large mistake on my part! I must've thought I added an empty string and didn't.

      Thanks for the tip, I honestly didn't know that strings had a join() attribute!

      Okay, I'll be sure to carry over the Example Test Cases next time. ;)

      Thanks for the revisions!

    • zebulan Avatar

      No problem, just wanted to help out!

    • smile67 Avatar

      Really don't know the use of "senseless edgecases" like addinge an empty string as input after having some working solutions without this special case. It's not important for the "problem" and not important for "coding". Because i often solve these beta katas very early, i often see such changes later on and i always ask me the same: for what? So this point is nothing special for this kata here (so keep on publishing good katas;-)), but more a general point for many katas. Worst case is to have more "edgecases" than codelines for the problem itself... same question here: for what;-)?!

    • zebulan Avatar

      @smile67,

      The original kata description clearly states that you were supposed to handle an empty string as an input:

      One last thing, if the string given is empty, or has all 0's, return black!

      The only part that was missing was the actual test case to make sure your function handled it. I just added that test.

      If you look at the kata authors solution, you would also see that the empty string input was being handled ever since the kata was written. It was simply a forgotten test.

    • smile67 Avatar

      Hi @zebulan, really quick response:-)... Can't remember the description of yesterday late evening (tired, heavy eyes, ...:-)), so probably you are right;-). I just read the messages, saw this point and many invalid solutions today... So as i wrote, it's often a bad point for many katas and a good place to point it out;-)..

    • zebulan Avatar

      @smile67,

      I know exactly what you are talking about, I have had many solutions invalidated because of questionable edits to a kata. I agree with you in principle that drastically modifying a kata after many solutions have been submitted should probably be frowned upon (unless it was to fix serious problems!). In this case, there were only a handful of passing solutions (I think about 5?), so I thought it would be better to fix it right away.

      I just wanted to reply because the kata did have that in the original description (it's still there). It seems the author did intend to check for empty string inputs (for better or for worse) but just forgot to put in a test for it.

    • smile67 Avatar

      @zebulan, nothing more to say there's not really a difference;-)

    • zebulan Avatar

      @smile67,

      The difference is that the kata was written this way from the start (to deal with empty strings in a specific way). A single test checking for that was omitted by accident.