7 kyu
Predict your age!
7,721 of 24,254Torkel
Loading description...
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.
For some reason I expected this kata to have some trick math solution, but alas, it's pretty straitforward.
The first test case is always false since the test was defined incorrectly. So it is impossible to "solve" this Kata.
It must be assert Solution.predictAge(65,60,75,55,60,63,64,45) == 87 not 86!
Ok... I must have missed the "down" in the description.
Ok, if after all actions i'll get 3.5, in which way i should round? To 3 or 4?
From the description:
Oh, down, thank you.
Doesn't work in Kotlin (sqrt). rounding does not follow the rules of mathematics
in C, the initial code should be a function definition, not a declaration
Another pointless and useless kata
please update the terms and conditions it says that you need to round the number to the nearest whole number, but in fact it should be rounded to the floor
Great kata, very enjoyable
enjoyed it so much
Update to Scala 3
.
Number of input are always same ?
Why don't you use array instead of age_1, age_2, etc.?
It's too late to change the kata design, it's been solved many times.
Please make sure it works for groovy..
Yes, it works.
In groovy it says that it returns a value but you cannot see that in the declaration of the funtion.
I like katas like this. Cause this atleast is a realy 7 kyu. Explained good, not too much text, not a math problem ether cause it was explained how to get the result. Like!
For the author, repeat after me: "Array...aaaaarray....aaaarrayyyyy !"
My greetings for your deceased ancestors !
Rest In Peace granny and thanks for your formula!
Interesting kata :)
fun kata!
wtf is this parameter ?
This comment has been hidden.
It was originally made in JS as an exercise to teach you about varargs.
It's too late to change the kata design, it's been solved many times. (Also it teaches new c0ncept about arguments of functions, so why not?!)
enjoyable
wouldn't be easy if the function only takes an int array containing all the ages? I'm just saying.
Yes, it would've lmao
It's too late to change the kata design, it's been solved many times. (Also it teaches new c0ncept about arguments of functions, so why not?!)
C++: Wouldn't it be more educational for newer programmers to use a vector or even an array rather than individual arguments???
It's too late to change the kata design, it's been solved many times. (Also it teaches new c0ncept about arguments of functions, so why not?!)
In Python, at least, it seems that the test cases only work if rounded down instead of rounded to the nearest integer, as stipulated in the instructions.
USE A LIST INSTEAD OF INDIVIDUAL ARGUMENTS...
Haskell : https://www.codewars.com/kumite/5b6a3a577dae898893000106?sel=5b6a3a577dae898893000106
Improved Haskell translation
This comment has been hidden.
Not an issue.
[R] Needs sample tests and initial solution wrongly declares
predictage
when submit tests expectpredict_age
Updated, thanks.
Thanks for updating :)
The Sample tests currently have the actual and expected arguments swapped - the failure message currently prints something like
target is NULL, current is numeric
instead of the other way round which may confuse beginners. Would you mind changing that as well? Cheers :)This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Java translation
Groovy translation
Approved, thanks.
Julia translation
Thanks.
CoffeScript translation
Approved, thanks.
Working on other translations (hope you are okay with me translating ?)
Sure.
C++ Translation
Approved, thanks.
I think this line is confusing on the python translated. Because it is list in the bullet points I thought this was part of the instructions. I probably spent 5 mins thinking "Which of one of these ages is the grandparents?" Imo, you should make is clearer that this is not a step in the calculation.
Erm, nope. In each version you're provided with 8 numbers being your grandparents' ages.
Description clarified.
This comment has been hidden.
it's part of the "game". Any warrior who doesn't do that will be "baffled" seeing other's solutions, so he'll actually learn that feature. So it seems pretty good that way, in fact. ;)
This comment has been hidden.
This comment has been hidden.
Is it better now?
.
Ruby translation kumited -- please check and approve
.
Hi guys, what about reranking at 8 kyu?
It was approved by Johan so you should ask him. I'm fine with
7 kyu
, especially when most8 kyu
katas are some super simple math (+ - * /
at best) or using a built-in function (speaking of high-level languages).I think 7 kyu is fine.
Looks more like 8 kyu to me: no loops, no arrays, just calling primitive functions.
Python translation available. Please, review and approve.
.
You should mention somewhere the returned age should be an integer (floored).
Note added.
Also rewrote the tests removing copy-pasted code and changing RNG range from
[1, 100]
to[40, 90]
(because your grandparent can't have a child if (s)he dies at the age of 1:P
).I was doing much the same thing at the same time. Please check if your edits have survived ( or been improved ). Sorry, one just can't see if someone else is already editing.
They were rewritten >_<
Including "round down" as a formula step instead of a note is strange, though (I'll probably change it to the way it was inside a translation).