6 kyu
Find Cracker.
1,181 of 2,171sipubot
Loading description...
Fundamentals
Arrays
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.
I completed it in the easiest way possible, and if it can help somebody, you should consider that the marks can be also 'E', 'F', 'G'
Python fork kumited!
fixes:
Approved.
This comment has been hidden.
may26,2023 10:12 - the code i wrote after attempt, number of failed testcases are 3, again i clicked on attempt, failed testcases are increasing decreasing[3,5,4,1,3,5.....]. and each time, one testcase is failed, the other time previous one getting passed, and passed testcase failing.... may26,2023 10:18 - after rechecking code and trying many attempt(same code) finally it accepted 🤷♂️🤷♂️😵😵
Thanks to your comment i found about this kata, took me a good couples of minutes but i figured it out. Try to read it carerfully, i didn't understand why i was failing until i read the part which says that the student gains 20pts more if they have 5 courses or more with grades of B or A only. Also the part which says that the points are capped at 200, which i also forgot and was giving me false positives. Maybe rewrite the code? Anyhow, good luck!
fixed in python.
The same happened to me , on the easy Tests casses , I don't now if it's my code or the Kata's problem. but the solution got accepted at last :) .
CoffeeScript translation
Java translation
Fixed tests 3: ['name3', 'name4'] should equal ['name2', 'name3', 'name4']??? Why???,,, the code should go perfectly
all other 204 tests have been passed
what are the inputs 'Fixed tests 3'???
Print the input yourself to debug your code: https://docs.codewars.com/training/troubleshooting#print-input
log outputs only on the 'test' button, not on the 'attempt'
Read the info on that link please, you need to write
print(whatever_value_you_want_to_inspect)
. In this case,print(arr)
. And that works in both, you need to write it inside your functionfind_hack
, not in another function that doesn't get called in the tests....
Where did you get that last 20?
ok, thanks
I had the same issue then I realized I needed to add logic to give the additional points only to those with 5 or more courses. Also just make sure to add 0 points to grades other than ABCD. I was adding undefined to an integer.
Tests pass, but I get "Cannot read property 'reduce' of undefined at arr.filter" on attempt. Can anyone explain what this means? I'm not using reduce or filter in my code. Is this a bug or a user error?
That happened because you mutated the input in your code. Now it doesn't matter.
So please forgive me if I'm missing something basic and this is a moronic question,
but it's a key part of this not to mutate the input?
When you mutate the input, unexpected results could happen. I've changed the tests so it doesn't matter anymore, but keep that in mind.
This comment has been hidden.
Print the input to debug your code.
Your code marks students having any other mark as hacked.
First of all, thank you! Also I found a mistake in my own understanding of the task. I didn't take account that any other letters except 'C' and 'D' lead to absence of additional 20 points. Briefly, we get 20 points if an array consists only of 'A' and 'B'. Unfortunately, i didn't understand it at first.
This comment has been hidden.
Read this: https://docs.codewars.com/training/troubleshooting/#expected-the-same
Not a kata issue. By the way, your code is not 100% right:
You don't have any return in your function
Thanks for the link to the trouble shooting guide. I didn't realise there was a print was unacceptabe on kata.
Nice Kata. The instructions were a little confusing though, I thought "should be capped at 200" meant the student should be returned as a hacker, not just keeping the score at 200.
Added another case to the kata's description showing that.
Simple issue,
Fixed.
This comment has been hidden.
That line is in your code, isn't it? Read the error message:
Not a kata issue. Print the input to debug your code.
array = [ ["name1", 150, ["B", "A", "A", "C", "A", "A"]], ["name2", 120, ["B", "A", "A", "A"]], ["name3", 160, ["B", "A", "A", "A","A"]], ["name4", 140, ["B", "A", "A", "C", "A"]] ] name4 A3=303==90+B1=20+C1=10==120+20 (20) OF LENGTH WHY STILL IN OUTPUT?
name4 should not get +20 at the end
why name3 got 160 and name3 and name4 has equal length of array and name3 score is getting 20+ extra because of length so why name4 should not?
Because of that, name4 has a "C".
ohh understood thnx
This comment has been hidden.
Is there a point to this post?
It would not make sense if the tests for the task were displayed in more detail. And so, I'm at a loss as to what I did wrong. I originally found a solution, it passed the tests. I decided to do a little refactoring. After that, the new solution fails the tests.
The question is not relevant. I figured out what's wrong.
can anyone explain me why name3 of sample cases not in output he scored 140 but actual score is 160
more and all courses has a grade of b or above ;) kinda confused thnx
Why ['Jack Bradley', 200, ['B', 'B', 'A', 'A', 'A', 'A', 'B', 'A']] isn't hacked? Sum of scores is equal 20+20+30+30+30+30+20+30=210 plus extra points and total cant be greater than 200, so why it isn't? Trying to pass random tests
no one can get more than 200 points, it's just a rule. if you have more, it is "downgraded" to 200. so jack got 200 points
oh thanks, got it
Remember that if student have more that 5 "clases" and scored B+ in each one score will be 200 points
Hello, i am having an issue with this kata, all the fixed tests are passed correctly, but every time i click atempt, arround 10 random tests apear in red. Is there someone else havign a similar problem?
Hi, this is because your code passes the
Sample Tests
but not theRandom Tests
. So, you will need to revisit the challenge and alter your logic. Look closely at the red text and see what tests you're not passing as a means to fixing your code. Best of luck!Good kata for practicing loops in arrays
tests pass, but when I click on "Attempt", it throws an Error. Idk what the problem
Read this: https://docs.codewars.com/training/troubleshooting/#print-input and use
console.log()
to print the input. Your code isn't totally right.In the example it said that "name2" has a score of 140 but he has a score of 110. 3x30 + 1x20 = 110
Fixed.
Mistake in Sample test: var array = [ ["name1", 150, ["B", "A", "A", "C", "A", "A"]], ["name2", 120, ["B", "A", "A", "A"]], ["name3", 160, ["B", "A", "A", "A","A"]], ["name4", 140, ["B", "A", "A", "C", "A"]] ]; Expected: ['name2', 'name4'] name1 should be in answer, because ["B", "A", "A", "C", "A", "A"] = 150 + 20 = 170. More than 150.
But there is C in that array, which means no extra points
Not a kata issue.
The error is still occurring
@jesusmanuelir@gmail.com There is no error, your code is wrong. Check the description again.
Thank you @Chrono79, I had not read the description correctly.
Wrong description :
Fixed.
Node 12 should be enabled (Refer this and this for more info)
Python new test framework should be used (Refer this & this for more detail)
The description should change
name2
toname3
in the outputFixed last point, also, check this: https://www.codewars.com/kata/59f70440bee845599c000085/discuss/javascript#60b4cec3631e92004215e1dd I think names should be unique or clarify that names can be repeated in the instructions.
This kata is complete nonsense
Python Random Tests contain cases when several students have the same name. I think it will be useful to add such case to description or Sample Tests. e.g. case with 'John Webb' from Random Tests
[['John Webb', 200, ['A', 'B', 'B', 'B', 'B', 'A', 'A', 'B']], ['John Webb', 250, ['B', 'B', 'B', 'B', 'A', 'B', 'A']], ['Jack Brown', 190, ['B', 'B', 'A', 'A', 'A', 'B', 'B']], ['John Brown', 160, ['B', 'B', 'A']], ['Bill Watts', 90, ['A', 'A', 'A']], ['Jane Watts', 170, ['B', 'A', 'B', 'A', 'A', 'B']]]
It's like that in javascript too. Maybe adding a note about that in description would be fine?
I think note will be fine
hmm description has wrong inputs and even first test case is wrong 'name1' 150 ['B', 'A', 'A', 'C', 'A', 'A'] = 430(120) + 120(20) + 1*10(10) + additional 20 points = 170 not 150 so name1 should be returned as hacked.
One course has a
'C'
there. So, 150 is ok for'name1'
in the first test case.okey got it.
in the description:
change name2 to name3
var array = [ ["name1", 445, ["B", "A", "A", "C", "A", "A"]], # name1 total point is over 200 => hacked ["name2", 140, ["B", "A", "A", "A"]], # name2 point is right ["name3", 200, ["B", "A", "A", "C"]] # name3 point is 200 but real point is 90 => hacked ];
return ["name1", "name2"]
shouldn't it return ["name1", "name3"]? since name2 is right
I see a mistake in discription in line: ["name2", 140, ["B", "A", "A", "A"]], # name2 point is right | 3*30+20 = 110 not 140 should be: ["name2", 140, ["B", "A", "A", "A"]], # name2 points is hacked
wery nice kata!)
What is the 'Random Check Bigger' ?. can some one explain ?
score : 150 [ 'name1', 150, [ 'B', 'A', 'A', 'C', 'A', 'A' ] ] score : 110 [ 'name2', 120, [ 'B', 'A', 'A', 'A' ] ] score : 140 [ 'name3', 160, [ 'B', 'A', 'A', 'A', 'A' ] ] score : 120 [ 'name4', 140, [ 'B', 'A', 'A', 'C', 'A' ] ] Expected: ['name2', 'name4'], instead got: ['name2', 'name3', 'name4'] The first test is wrong, please fix this :)
If there are 5 or more courses and all courses has a grade of B or above, additional 20 points are awarded.
Python translation. Please, take a look at it.
.
Can you update it to support python 3.8? ~~
"All courses are above B", but the tests want above or equal to B
Fixed
This comment has been hidden.
Oh! Thank :>
A: 30 points B: 20 points C is 10 points D
But you use other letters like F, G ...
add description that
You have to disregard grades below D
Fixed the descriptions. It should be actually clear now.
Description is unclear, to the point where the task is unintelligible. Please explain the task with more clarity and structure, and possibly with examples of unhacked and of hacked results.
ok i will fix it next day :)
done
This comment has been hidden.
Thank for notifying :) i will fix it
done