Draft
Quadruple M
304 of 444Caders
Loading description...
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.
This doesn't seem different enough to what you would get in a basic tutorial.
round(x,2) will work after trying multiple times.. :)
This comment has been hidden.
It has already pointed out by mauro-1 months ago, so duplicate issue. This kata has rounding issues.
This comment has been hidden.
The solution is not in not tweaking one's solution, but in designing properly the kata so that it accepts reasonnable divergencies in float calculations.
In this case, isn't the only way to remove the rounding requirement from the kata itself.
Once you get the rounded numbers, you can't differentiate between
A very close match (numeric errors)
Algo A: 2.3649999999999999999999 -> 2.36 Algo B: 2.3650000000000000000000 -> 2.37
A very big difference (potentially wrong calcuation) Algo A: 2.3550 -> 2.36 Algo B: 2.3749 -> 2.37
Yep, that's the point of
test.assert_approx_equals
(see mauro-1's message below).Understood. So there will be a new version of the kata without the rounding at some point.
Hopefully the author of the kata changes the tests this way. That would solve This issue.
I don't get it, why the average of two middle items in this list
[-1, 10, 2, 0]
is 1 instead of 6?[-1, 10, 2, 0] -> [-1, 0, 2, 10] (middle items of SORTED list)
Average of 0 and 2 = 1
In python the natural way to return multiple values is using a tuple, not a list.
Rounding prevents correct float comparision. Two similar values (within tolerance) may be rouded to different values.
Floats should be compared with
test.assert_approx_equals
.is this kata really in beta since over 4 years? Time to go out of Beta maybe? :D
Also this line of the description should be rephrased:
"med is the number in the middle when the list is sorted. Should the list have an even size, take the two numbers that are 'most' middle."
"most middle" is confusing and should be something like "Should the list have an even size, return the average of the two middle values."
Absolutely agree, i was very confused with the wording of the question
Agreed.
This is not new. All 4 operations required already exists in many existing katas.
This kata reminds me a joke:
"On average, people are mean."
JS translation kumited.
; ) )
approved
This comment has been hidden.
You can find my Ruby translation available here and my Crystal translation available here
Please review and accept if everything is ok.
Description says:
if the list has an even amount of numbers, return the average of them for the median.
It might be more clear to say:
if the list has an even amount of numbers, return the average of the two numbers in the middle.
in python 2.7.6: [993.03, 50.52, 531.15, 550.11] should equal [993.03, 50.519999999999996, 531.15, 550.11]
Fixed. Thank you for reporting.
There's a problem in the Python translation . All the items in the return list are supposed to be rounded upto 2 points . But error pops up in 3.4.3 when I try to round the min value ! Although it's a trivial bug but I think it should be fixed :)
Fixed. Thank you for reporting.
This comment has been hidden.
I'm updating the
Test Cases
and description to round to 2 decimal places.Thanks for bringing this up.
Could you update this in your description as well. All the numbers should be rounded of 2.
[983.84, 34.5, 341.34000000000003, 445.85200000000003] should equal [983.84, 34.5, 341.34000000000003, 445.852]
Does it work as intended? I would suggest adding some rounding.
I'm updating the
Test Cases
and description to round to 2 decimal places.Thanks for bringing this up.
Still an issue in 3.4.3 (edit: in 2.7 too) :(