7 kyu
Two numbers are positive
2,740 of 7,040CodewarsDenis
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.
This solution is clearly wrong as can be seen by testing it with inputs
(1,2,3)
(expected0
, produces1
) and(1,-2,-3)
(expected0
, produces1
). Nevertheless, it passes the test suite every last time. Might I suggest adding an element of randomness into the testing so thatc
is not always1
or0
?C++ Translation
There's an error in one js test error message
assert.strictEqual(twoArePositive(-4, 6, 0), false, '(4, -6, 9)');
should beassert.strictEqual(twoArePositive(-4, 6, 0), false, '(4, -6, 0)');
Fixed.
nitpick: a minor typo in the description
two of [of] the three
.Fixed.
i passed the tests, yet my solution is wrong for 2*positive and 0
Not anymore. Test cases have been updated.
"twoArePositive": Test case is buged returning:
(4, 6, 10): expected true to equal false
Clearly all numbers are positive but they expect false please correct the wrong test case.
Please read the description. It's one line; you should be able to do that.
That test is correct.
You're supposed to check if there are exactly two positive numbers.
Why 4 6 10 == false?!
Please read the description.
Rust translation
approved
PHP translation
Approved by someone
TypeScript translation
Approved.
This comment has been hidden.
Well seeing all the beginners struggle with this kata I would say there is clearly a demand for it. The only thing which is off is the rating of 7 kyu while it should clearly be an 8 but that's already too late.
possibly actually reading the description is a novel idea for them. but that's no reason to have this kata; any other kata will do.
Description should be language-agnostic
JS, C#: missing test case for two positive and the other 0. Some solutions (including mine) would fail this test.
Kumite with fix for JS
That's actually a pretty nice format for the test cases! Approved.
Added also for C#.
And while I'm at it CoffeeScript translation
Approved.
No duplicate issue raised in 2 years. no other issues.
Approved
Please clean up the "please rate this kata"
Downvoting and not explaining why is just lazy
Comparing values is not a novel idea; trivial/map/filter reduce is not a novel idea; sorting a list is not a novel idea. As said by "FArekkusu", awaiting the response from an admin about the situation
Since no activity has happened to this kata for over a year, not including this post, I will mark this issue as resolved and an admin could decide if they want to approve this kata because they already know all the rules. If this kata would be disapproved, I will unlist it.
Comparing values is not a novel idea; trivial/map/filter reduce is not a novel idea; sorting a list is not a novel idea.
Why do you keep typing this? I already told you that it doesn't matter if the idea is novel or not
As user9644768 said below, "Raise a proper issue of duplicate by linking the potential original kata of which you think this is kata might be duplicate of( and if you're lazy to do that just don't raise issues at all ). The way you've raised this issue is pretty much bogus and opiniated providing no clue whatsover to the author about what exactly is wrong.", this issue is resolved.
There is ambiguity in mathematics about whether to consider zero a positive number. In JavaScript, for example, the "Return Value" section of the Math.sign function on MDN says this:
Given the ambiguity around whether
0
is a positive number (i.e.+0
), or both a non-positive and non-negative number, please update the kata instructions to clarify the expectation implied in the tests.I recommend changing the following line:
...to:
...or:
Fixed
Comparing values is not a novel idea; trivial/map/filter reduce is not a novel idea; sorting a list is not a novel idea.
Stop closing issues and bumping this kata; it is not good, and no way it should be approved at any point.
Then, can you give me an example of a kata that uses this?
Why do you type that on every beta kata?
There are hundreds of katas that use the same idea. It doesn't matter if the idea isn't novel. What matters is if the kata is novel not the idea. Example: Search "sorting" and you will see how many katas involve sorting a list
A kata is novel when its idea is novel, what on earth are you talking about? Are you so desperate to get this approved that you're willing to speak literal nonsense?
I am not speaking nonsense. When you search "sorting" in katas you will see hundreds of katas involving sorting a list
What you said isn't right. For example if someone made a kata about multiples of 3 and someone else made a kata about multiples of 5, you would go around and write "Multiples is not a novel idea. This kata should no way be approved at any point."
Comparing values is not a novel idea.
Stop making issues about this
Comparing values is not a novel idea.
There are lots of ways to solve this kata, not just comparing values.
PHP:
Error : Call to undefined function arePositive()
I have deleted PHP and Ruby because there was a lot of issues and I don't know these languages.
ruby:
I have deleted PHP and Ruby because there was a lot of issues and I don't know these languages.
Comparing values is not a novel idea.
How is it not novel?
There're already numerous katas which ask you to compare inputs (with some fixed value, or with each other). The fact that the inputs are shuffled doesn't add much to the task.
Comparing values is not a novel idea.
What do you mean?
C# Translation ready for review. (It's my first translation, so be gentle :)
Thank you for your translation
This comment has been hidden.
Fixed
Filtering and validating values is not novel.
Nothing has been fixed. The only way to fix it is to unpublish.
How is it not novel, if I created this kata myself?
Raise a proper issue of duplicate by linking the potential original kata of which you think this is kata might be duplicate of( and if you're lazy to do that just don't raise issues at all ). The way you've raised this issue is pretty much bogus and opiniated providing no clue whatsover to the author about what exactly is wrong.
Not novel
Mi mi mi, mi mi mi
7 kyu katas currently aren't novel ideias...
It is ok...
Is multiply novel?
No, the thing about novelity is to be the first to explore an idea. Multiply can be considered novel because it was the first kata for that concept. However, any katas produced after that can be considered not novel/duplicate.
This comment has been hidden.
What do you mean?
Fork it, run it, see it fail random tests ( because the logic is not entirely correct ).
Those random tests should be added as fixed tests.
It doesn't fail
Run it a couple of times. It will.
It not failing, sometimes, is exactly the problem.
Added the fixed tests
Filtering and validating values is not novel.
Fixed