7 kyu

Noonerize Me

771 of 1,599webtechalex
Description
Loading description...
Mathematics
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • MyNameWahyudi Avatar

    Can someone help me, when i run my code in basic test, i have passed it, But when I run the code where I click the attempt button, I get the problem where the basic test is said to fail with the statement "expected NaN to equal 'invalid array'" and for random test i passed it.

    • Evokoo Avatar

      Within the insturctions you will find the following line.

      Your code must test that all array items are numbers and return "invalid array" if it finds that either item is not a number.

      [100, 200] // Both values are numbers so the array is valid
      [100, '200'] // The second value is not a number so the array is invalid
      ['hello','world'] // Neither value is a number so the array is invalid
      

      There are no set tests that require validation which is why you pass them but fail the random tests.

      If you have written code to validate the array and still getting an error there may be an issue within your code.

      I hope this helps, goodluck :)

  • laurelis24 Avatar

    This wasnt hard, but at the end my answer looks horrible.

  • Kees de Vreugd Avatar

    This might be the first time I came up with a unique, horribly unperformant solution. :-D

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • FArekkusu Avatar

    Python 3 should be enabled.

  • OscarAlvarez Avatar

    Ruby random tests are definitely wrong. They're looking for the difference without spoonerizing the numbers first.

    • webtechalex Avatar

      Okay thanks Oscar, @GiacomoSorbi can you confirm this?

    • omegahm Avatar

      Can we please get this fixed? It's been a year since this issue was raised.

    • GiacomoSorbi Avatar

      They pass for me, so my guess is that you were working directly on the array (very bad practice), which now I prevented from affecting anything else.

      Also, so far 25 Rubyist completed it without further issues, so...

      Issue marked resolved by GiacomoSorbi 8 years ago
  • WillLearn Avatar

    how can [1,0] and [0,1] yield the same answer? (1)?

  • matt c Avatar

    There are no random invalid tests.

    • donaldsebleung Avatar

      Nah, don't think this Kata needs random invalid tests. After all, who would bother cheating by passing in the first few fixed values (which includes invalid input) only to code a perfectly working algorithm for the remaining (perfectly valid) random tests?

      I personally think raising this as an issue is a bit too harsh. Mark it as a suggestion maybe?

    • webtechalex Avatar

      Thanks both, for your support. Whether it's an issue or a suggestion I am looking into how to do this. Giacomo says he will be working on a Ruby translation and will include random invalids in that, so I can see how it works. I will add them as soon as I can :)

      In the mean time I have made the fixed invalid tests more sophisticated.

    • matt c Avatar

      It's best practice is the reason I raised this as an issue. It's also good to provide invalid tests so the users can get a better understanding on how to handle invalid input, if all they have to worry about are the fixed invalid tests it doesn't really make it hard for the user to create validation against that. Though I will mark this as resolved. :)

      Issue marked resolved by matt c 9 years ago