7 kyu
Noonerize Me
771 of 1,599webtechalex
Loading description...
Mathematics
Arrays
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
python new test framework is required. updated in this fork
approved with thanks :)
.
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.
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.
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 :)
This wasnt hard, but at the end my answer looks horrible.
This might be the first time I came up with a unique, horribly unperformant solution. :-D
Ruby 3.0 should be enabled.
Enabled in this fork
Python 3 should be enabled.
Thanks FArekkusu. Should be good to go now. Let me know if you have any problems ;)
Ruby random tests are definitely wrong. They're looking for the difference without spoonerizing the numbers first.
Okay thanks Oscar, @GiacomoSorbi can you confirm this?
Can we please get this fixed? It's been a year since this issue was raised.
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...
how can [1,0] and [0,1] yield the same answer? (1)?
ah, subtract in kind to only leave positive values.
There are no random invalid tests.
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?
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.
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. :)