7 kyu
Cat Years, Dog Years (2)
1,718 of 3,795dinglemouse
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.
Hi Guys, I have with C# all the first tests were successful, but when I push ATTEMPT buttom the very same tests fall. Have you experienced the same?
Groovy Translation
Approved.
Hello, can you help me? Tests all passed(Ruby) Test Results: [15, 15],[24, 24],[56, 64]. Basic Tests Expected: [1, 1], instead got: [76, 89] i don't know why
Because you're probably using multiplication instead of division
C Translation
Approved. Thanks.
.
This comment has been hidden.
14?
This comment has been hidden.
If I understand what you are asking then if I've owned the cat for < 15 catYears, or the dog for < 15 dogYears, then I have not yet owned them even for one full human year. Maybe I've just owned them for 0.75 human years (or whatever)...
The Kata says "Results are truncated whole numbers of human years", therefore anything < 1 will be expecting 0.
Make sense?
meow
How does someone have the ability to speak such wise words?
python new test framework
Approved
This comment has been hidden.
Fail random test: Random test 1: catYears=56, dogYears=28 => [10, 2] Random test 2: catYears=100, dogYears=64 => [21, 10] Random test 3: catYears=53, dogYears=86 => [9, 14] Random test 4: catYears=16, dogYears=50 => [1, 7]
But how it's could be correct? catYears=16, dogYears=50 => [1, 7] I thought 15<catYears<=24 is 2 humanYears...
I don't remember the kata exactly, but from what I see, I think you own it for 1 year when it's
15 <= catYears < 24
, and 0 before that. How do you get 2 years?in previous Kata it was another condition. 1-15 cat or dog Years equals 1 humanYear, etc. In this Kata 1-14 cat or dog Years equals 0 humanYear, 15-23 cat or dog Years equals 1 humanYear, etc.
So simple, yet i feel like a moro*. xD
thanks ,I enjoyed both 7 and 8
This comment has been hidden.
Approved :-)
Am I right that I can solve this kata ignoring one of the animals? If yes than it's an issue.
When reporting an issue, state the language you use, right now this kata has 4.
It's Java. Also I drew this conclusion based on what I saw in some of the given tests. It may be that I'm mistaken.
I don't see what you say it's happening, could you paste your code (formatted) and mark your post as having spoiler content, so I can check it?
The fixed tests have the same expected values for both cat and dog, the random tests don't. If that's what you saw, mark the issue as resolved.
Yes, I rechecked and you are right.
You should specify somewhere that only complete years should be returned.
Kata description already says
I see.
I think it's unclear what truncated would mean in the context. Do you mean "rounded down"?
For those still confused, to truncate a number is to eliminate its decimal, without touching the base.
(If used alone,
truncate
meanstruncate to 0 decimals
, but you can actually truncate to the number of decimals you want)Examples:
All is correct, but the compiler produces this error. Arrays first differed at element [1]; expected: 0 but was: 1 Random test 4: catYears=7, dogYears=22 => [0, 1] Random test 20: catYears=100, dogYears=15 => [21, 1] Random test 67: catYears=61, dogYears=21 => [11, 1] But 22 -> 1 year 15 -> 1 year 21 -> 1 year
Which language?
It seems he only coded in Java so far.
Java
Please cut/paste the console log of your failing random test instead of re-typing it. I don't quite trust what I am looking at...
e.g.
Random test 1: catYears=75, dogYears=16 => [14, 1] Random test 2: catYears=54, dogYears=54 => [9, 8] Random test 3: catYears=23, dogYears=94 => [1, 16] Random test 4: catYears=99, dogYears=74 => [20, 12] Random test 5: catYears=15, dogYears=14 => [1, 0] arrays first differed at element [1]; expected:< 0> but was:< 1> In first message I also use copy-paste, but delete tests where there is no 1 at element < 1>
OK. Please be aware that the Random test output my expected values.
For example, the test 5 is saying dogYears=
14
means owned for humanYears=0
([1,0]
the 2nd element - e.g. array index 1 is0
), but your solution returned1
And that is the correct result (14dy -> 0hy) because Kata description says
Results are truncated ...
So your solution is incorrect.
Thank you very much for your help! I found a typo in my code.
:-)
This kata put smile upon my face :). It was a little bit tricky.
:-)
Kumited Python translation I think it works with 2.7 too.
Translation approved. Thanks :-)
Thanks
@B4B
for approving.