7 kyu
Scoring Tests
1,370 of 3,394CajunAzn7
Loading description...
Arrays
Fundamentals
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.
t(str, right, omit, wrong)
first param is str, but str is used for strings, not arrays. arr would be better for first param.
This comment has been hidden.
A minor typo in the description:
For o[m]mitted answers, ...
fixed
COBOL:
rightPoints = 2, omitPoints = +1, wrongPoints = 5 xs = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 0, 6]
fixed tests in random tests should not have6
Removed in this fork: https://www.codewars.com/kumite/61e3f73bf41a42000ee7b5c5?sel=621b665e4d8b7b0069e12d27
Approved
COBOL translation (author inactive).
'issue' approved ;)
C Translation kumited (author long gone).
Approved :)
Java translation: https://www.codewars.com/kumite/61e1e753eb372a000775d595?sel=61e1e753eb372a000775d595 Thanks for approval (author inactive)
Approved.
No random tests.
Added random tests to python, ruby (haskell already has them).
JS is still lacking
Added for JS (updated it to Node 12. as well)
C# translation, please check and accept. I've also added integers other than 0,1 and 2 because all the other translations have them. You may want to update your description :-)
In the kata description, it is explicitly stated that the passed in array will only contain 0s 1s and 2s but in one of the test cases (Ruby), the array contains 4s as well. This edge case should be added to the kata description as well as what the method should do when it encounters invalid values such as this.
Fixed ruby tests to include only valid values.
Javascript version of Kata could ideally include some random tests as well as fixed ones.
An issue was created for this
The last two tests have invalid answers values, and expect a result. Please either suppress or explain what to do with these invalid values.
Most solutions pass because they do not process these values at all.
I would not appreciate a teacher reasoning I don't if it's wrong or right... just forget it. :)
Definitely agreed! It just happened to me in ruby version.
我觉着题意有点难理解。难道是我英文不好?题干里加点例子就好了。
This comment has been hidden.
哈,在不考虑性能的前提下,当然是越简略的代码越好
Haskell needs example test cases.
added some time ago
Is this appropriate as a 7 kyu kata?
honestly i dont know
It should have "arrays" instead of "strings" on its tags.
Thanks!
Python: function name is
scoreTest
and in the tests it isscore_test
.Fixed the problem, just noticed it although two other people pointed it out before. Thanks!
Test case functions do not have the same name as the written function.
I think it might be a glitch, because mattface (below) had the same issue but I couldn't find anything wrong with it when I tried it.
Finally just noticed the problem. Thanks!
function name was wrong, didnt match test cases
I can't seem to find anything wrong. Can you tell me where it is?
huh, strange.
When I did it, the example code was scoreTest, but the test cases were calling score_test.
Seems fine now.
PEP8:
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.
Changed it now. Thanks!
Consider changing the description to indicate that the score for a wrong answer is to be subtracted. This is not immediately clear from the description, because it says that "wrong" may take positive and negative values.
Thanks for the input!
@jimbolatte if the description of the original kata changes, the translation and the kata diverged. You need to fork your own translation if this happens. The old translation gets retired/un-published automatically during the process and you can publish the fork after you've manually merged the description.
(Cannot comment on your translation due to #68)
Ah, thank you very much! Makes sense. The documentation would be a good place to mention this -- or maybe I just didn't see it.
Consider using an array/list instead of a string as argument. After all, every user will transform it to one either way, but it's really inconvenient in some languages, e.g. it's horrible in Java (note: I don't use Java, but it's better if you use the correct type regardless of the language).
I agree with giving an array to start with.
But I can't say that I find
String[] scores = str.split(" ");
so horrible. :-)That's still not an
int[]
, which I was looking for ;). But sure, one doesn't need aint[]
to solve the kata,String[]
would be fine.It's true that mapping a type conversion is more cumbersome in Java than most of the other languages here. :-)
Now it's an array. Thanks for the input!
Nice little kata. :-)
Thanks!