7 kyu
String matchup
1,863 of 5,046KenKamau
Loading description...
Algorithms
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, check kata [Translation] [Dart] [0]
JavaScript should be updated to Node 18 and use chai.
Updated in this fork
Issues on lua tests being flipped get closed and ignored. I guess I'll just raise it again? I'm confused, and fail to see why this would be difficult.
It's difficult only when people choose to be difficult.
Hopefully, today it will be easy.
(🤖) Should be fixed, please verify.
fourth time's the charm
Go translation
python new test frame work
Approved
meh
I've forked the Rust translation in order to update it to Rust 1.49 and updated
rand::Rng::gen_range
to its new signature that takes astd::ops::Range
.Thanks.
Lua: Test output is flipped. (Also the phrasing "passed in" is very unfortunate because that suggests it being input as opposed to actual... But I suppose that's the test framework's wording.) Showing the input would be nice too (input, actual, expected)
reproducing/example
(default/initial code)
test/error output:
Every time I flip them, someone else says to flip them back.
So what you're saying is that
nil
is the expected outcome for all tests?I've flipped them. Let's wait for next guy to request a re-flip.
eeek!
the 'same' function requires a minimum of 2 arguments, got: 1
also, sample tests :^)
Back to being flipped I see >.<
Expected and actual are still flipped. See docs (
busted
is the Lua testing framework on Codewars) to be sure once and for all :)Expected objects to be the same. Passed in: (table) { [1] = 2 [2] = 1 *[3] = 0 } Expected: (table) { [1] = 2 [2] = 1 } I found that the result of the problem is different from the result in the test case. Is this because I made a mistake? :v
I have a feeling that you have not yet investigated what the input was and what your function returned for that input. My guess is that your result is missing the third value.
Question, not issue.
Sorry everyone, I'm a newbie, I don't understand what is an issue or question: v I will pay more attention later. Sorry ^^"
So "Passed in" is the true result and "Expected" is what I have done? My English is not good, sorry :((
It's the other way round: "Expected" is the correct answer, and "Passed in" is what your solution returned.
So specifically in my case, my result be an extra element and that is the reason I am wrong? :VV
@bananaback The error message is flipped around, your result is shown as expected and vice versa. It also doesn't show the input. You can however print out your result and the input you received and that way figure out what's what.
Thank you so much! <3
Clojure translation for review
https://www.codewars.com/kumite/5fb642390d55fa001800e01b?sel=5fb642390d55fa001800e01b
Thanks
nice and easy
Lua Tests seem to be flipped as well, and some solutions dont make sense to me a = {tymrvliayc, gnoynzzlffuza, xyqenuyvkkcnhlc, fjyuhmthyz, ysgpduhplhdxipe} b = {gnoynzzlffuza, gnoynzzlffuza, ysgpduhplhdxipe} my solution {1, 1, 1} test passed in {0, 0, 0} expected {1, 1, 1}
98 solutions passed. Please check your code.
Something's up with the python version of this. My code keeps returning jumbled up/random counts of list elements (i.e. [0, 1, 2] should equal [2, 0, 1]).
I tested the exact same code on trinket.io using test cases from here and I get the expected correct results. Not sure what's going on?
Are the test cases correct? My solution is outputting the correct value based on the information in the testing case but still flagging it as incorrect.
For example:
Test case returns:
Your code is incorrect. Actual and expected are flipped for JS.
Ok so it's supposed to include the duplicate strings in the solution. That's fine but you shoud update your test cases otherwise it's very confusing.
Test cases updated.
This comment has been hidden.
It looks like an 'm' is missing on the first line of the Lua solution setup.
Apologies for that. Now fixed.
Please refresh your page.
can this be solved with javascipt? It passed the tests except for the random numbers, but randit and randrange are python functions right? how would you do that with javascript? My solution is along the lines of comparing each item and adding the count to another array
There is a very elegant one line solution for JS, but that is not important for you. Just find a solution that works, even if it's 20 lines. And yes, randit & randrange are python builtins, and are not relevant for your solution even if you were solving it in python.
Approved
Thanks Voile.
Cleaned up the description a bit.
Also fixed the test cases: you should always use
Test.assert_equals(user_solution, expected_solution)
, not the other way round.I also rewrote the random test suite to make it clearer, leaving yours as a comment. Feel free to use it or scrap it :-) Some words of advice:
randint()
is a "simpler version" ofrandrange()
a = func()
(returning a 2-item list) then usinga[0]
anda[1]
, you can usea1, a2 = func()
Oh, and you may raise the difficulty of the tests (more and longer strings, more repeats, etc) without any problem.
Cheers
Many thanks anter. I will keep this in mind.
be careful with that: two different functions! randint is inclusive for both values and has to be called with 2 arguments only while randrange is like... well, "range" of course.
Thanks B4B, anter. I will need to do some research. I've been using randrange(), but will need to better understand randint().
Sure. What I meant is that if you simply need a random number between
a
andb
(inclusive), then userandint
. If you need all the bells and whistles ofrange
(that is,step
?!), then userandrange
.But it's best to read the official docs: https://docs.python.org/3/library/random.html