8 kyu
Abbreviate a Two Word Name
76,234 of 189,413samjam48
Loading description...
Strings
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.
Решил эту задачу, все достаточно просто, если делать через список.
Using python 3.11, getting the following results. Test Results: Fixed Tests Basic Test Cases Log S.H None should equal 'S.H' Log P.F None should equal 'P.F' Log E.C None should equal 'E.C' Log P.F None should equal 'P.F' Log D.M None should equal 'D.M'
You need to return this result, not print it to console.
Shell Translation here, please approve:
https://www.codewars.com/kumite/6701fe959b0434f8c31e3f1d?sel=6701fe959b0434f8c31e3f1d
This opens up many new ways of thinking and is really useful for new coders.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
What part of instructions exactly, and what part of the starting code, say that the function should accept two parameters?
You shouldn't rely on description to explain everything. After solving near 100 katas, you should start to become comfortable with reading and understanding "Sample tests" section.
Not to mention that, when using a language like JavaScript, you can verify this by changing the function signature to accept any amount of arguments, and running the tests:
Wow, thank you guys for the quick response. I was confused by the starting code in the console showing: function abbrevName(firstName, lastName){}. This made me think that the solution should accept 2 parameters. I was able to easily code a solution using 2 parameters in my IDE but the solution was not accepted here, which led me to believe that the kata was confusing. My fault, the instructions don't actually say that the solution should accept 2 parameters. Thank you for the advice regarding the sample tests section and function signature. I am still quite new here and I appreciate all the advice I can get!
But where do you see the
function abbrevName(firstName, lastName){}
? It's not in the kata trainer, because initial solution stub has only one argument. I cannot see it anywhere in the trainer, nor in the description. Where did you find this?oh man. It's a convoluted story, but I made a dumb mistake. I wish I could take my original comment down now but I don't know how. Rough day lol
This comment has been hidden.
Please don't post solutions in Discourse.
This comment has been hidden.
on Codewars,
return
your result instead of printing it. the tests use the return value of your function.Lua translation!
Approved
This comment has been hidden.
When I run it, based on the description my code produces the right answer but then the expected it some weird answer. E.g. Sam Harris should be S.H which is what my code produces but then it says the expected is "te" or the expected will be empty.
In what language?
Knowing your code would also help to find problems in your solution.
This comment has been hidden.
I'm not sure why exactly, but modifying
initials[4]
causes this. You shouldn't be modifying data out of bounds :PAh I see. Thank you. I thought that, as the initials array was origninally setup(dont know the right terminology) to have four indexes, I had to make sure that both were addressed.
It has
4
places but since you start counting at0
yourinitials[4]
is already out of bounds.Not a kata issue.
Strange task, I decided to do it in my visual studio, checked it, everything works and gives the correct values, I upload it here, it doesn’t work here
So it doesn't work :P But you're not exactly telling what doesn't work, so we can't really help...
See https://docs.codewars.com/training/troubleshooting
Can you show the code which you think is correct, but does not pass tests?
This comment has been hidden.
Can you show the code which you think is correct, but does not pass tests, in a readable way, using code formatting?
This solution is wrong for two reasons:
This comment has been hidden.
I did it with javascript and the answer is correct, the test results are correct but why...
This comment has been hidden.
Please, don't post solutions in Discourse.
Kotlin: Sometimes empty names get generated altough it is said that the kata "strictly takes two words with one space in between them."
Duplicate issue below
This comment has been hidden.
my understanding, they ask to solve through the function def
change 'word' on 'name' and 'print' on 'return', please
I got the same result like in the sample but Test is failed. What is wrong?
See the initial code for Python:
Why did you change the function's name?
Thanks for tip. I didn't know that the suggested name does make sense
I have solved this task. My issue was - changing the function name in the first row
This comment has been hidden.
Please use appropriate markdown formatting and flag your post as a spoiler when posting code. See https://docs.codewars.com/training/troubleshooting#post-discourse.
You need to return your output instead of printing it. See https://docs.codewars.com/training/troubleshooting#.print-vs-return and https://docs.codewars.com/training/training-example.
Thank you!! i forgot to mark as Spoiler, sorry about that.
This comment has been hidden.
I am getting frustrated because every exercise I do tells me that what is supposed to be inserted is undefined.
Your frustration is not a kata issue. Please see if this article or this article would be of any help. You are also welcome to visit channel
#help-solve
or#beginners
on Codewars Discord and ask for help.This comment has been hidden.
Why there are no point after second letter in the answers.
Guys i have a question. I solve it in IDE its kinda chalanging but i did it, however i was using package "stings" but test faild. How else i can solve it?
Ok I import "strings", but now i have another problem, and have no idea what is that...
Test Results: Test Example should test that the solution returns the correct value Expected : s.h to equal : S.H Completed in 0.6276ms
This means your code return
s.h
while it should returnS.H
. You can refer to this documentation for more help on debugging solutions: https://docs.codewars.com/training/troubleshootingThis comment has been hidden.
With Kotlin 1.9 enabled, this issue should be fixed
This comment has been hidden.
This comment has been hidden.
That you're printing the result instead of returning it: https://docs.codewars.com/training/troubleshooting#expected-the-same
That's a reilef,, thanks
I don't understand why there's a field for initials in the parameters of the function, in C, when those are what you're trying to get. Could someone explain?
It's a pointer to enough space for you to write the output, and then you return that same pointer. I'm not sure why people do it this way since the calling function already knows where to find the result. IMO the function's type would just be
void
in this case, unless you need to returnint
for a success/error code, but there may be another reason for it.@Pastifier
initials
is an output parameter provided by the caller of the function so that you do not have to allocate your own memory for the result. As specified in the initial code, you have to write your answer (the initials) to this buffer, and return this same buffer.@dbtx This is a common pattern which enables function calls chaining. It is common in the standard library (
strcpy()
,memcpy()
,memset()
, ...)This is a very good one for you to learn on. It took me a while, but it was a good challenge, to me as a new coder.
Rating: 4.5/5
This comment has been hidden.
This comment has been hidden.
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/196.
Please join the discussion to help us identify duplicate kata and retire them.
This kata was decided to stay.
This comment has been hidden.
Upon passing the test, you may not see the final output due to how the runner is setup. So, it is normal for you to see
test passed
or any other equivalent messages. You can however definitely see your final output if you print it to the console ^^This comment has been hidden.
This comment has been hidden.
Please write in english. Look at the initial code:
Don't use other function's name, the tests won't find it. And mark your post as having spoiler content next time, please.
This comment has been hidden.
Read this: https://docs.codewars.com/training/troubleshooting#expected-the-same
In kata: https://www.codewars.com/kata/57eadb7ecd143f4c9c0000a3/train/julia
the following appears when sending, several times, my solution to TEST:
++++++++++
Network Error
This error was caused due to an issue processing the web request, not because of an issue executing your code. You can retry the request.
and at the bottom: AUTHORIZATION FAILED
++++++++++
No problem accesing other options in codewars.
Hope someone can help me.
See https://status.codewars.com/incidents/ymg0y1r172sl
checking: https://status.codewars.com/
shows:
Network Error
Subscribe
Identified - The root certificate of the cluster had expired. Performing a credential rotation.
Mar 30, 2023 - 01:10 UTC
Investigating - We are currently investigating this issue.
Mar 30, 2023 - 01:04 UTC
O.K. I hope they fix it soon.
This comment has been hidden.
Please read this: https://docs.codewars.com/training/troubleshooting
Your code is wrong, not a kata issue. You're printing something and returning something else. What the tests compare against the expected value is what your function returns, and you're returning a list.
In C, the wanted test results are blank or random character.
For me it says for name: Sam Harris expected: �� but got:S.H.
I don't know if i'm at fault or do the test just not work.
When you do not know, you ask a
question
;-)Your code contains undefined behavior. The result should have 3 characters (+ 1 nul terminator in C). You are accessing
initials[4]
---> this is one past the end of theinitials
array. You are accessing memory you should not be, hence chaos ensues in the tests suite.This comment has been hidden.
The worst kata I've ever taken was one that strictly required two words with a single space between them, but it included a one random word in the test case.
I think this is harder than 8 kyu. I solved stuff up to 6 kyu but this one was harder.
Tests should definitely include non-unicode inputs.
This comment has been hidden.
Your code adds a space at the beginning because of how you initialize
abbrev
, not a kata issue.Как я понял, в рандомных тестам используется случай -> если пользователь введёт (" . ") Хотя в инструкции к задаче не было указано об этом.
This comment has been hidden.
kata solution != kata suggestion
nice, thanks!
This comment has been hidden.
Which language are you talking about?
This comment has been hidden.
I think my solution is correct but i can't get through the tests. I test my solution in my own IDLE and I get the correct solution. I don't understand where is the problem. Hope someone can help me.
Your code not working is not a kata issue. Issue is when you find a bug in the kata. I just run Python version of the kata and it does not seem to be wrong, an expected solution passes tests correctly.
Please see this article: https://docs.codewars.com/training/troubleshooting, or show your code so we could see what is wrong and help, or come to Codewars Discord for some help!
Good luck!
I just found the error! I was including print at the end of my solution and it was not necessary. Such a silly mistake. Thanks you for the quick answer anyway!
None of the "Test" tests account for nearly as many scenarios as you may encounter on the "Attempt" tests. You can very easily pass the initial tests and fail the attempt.
This is very common, this is why there are random tests, and this is not a kata issue.
I will elaborate. The given tests imply that the initials will be derived from two-letter/word names, i.e. "John Smith", "P Jones". They are not just random test cases. They are test cases that that could not be accounted for with the given instructions or the given tests.
Valid random test cases based on the example tests and instructions could include:
"John Smith" "Akar O" "Proper Testing"
Outside instruction tests could and do include:
"John Has An Unexpected Amount Of Names" "Wow Look This Is More Words Than Anticipated"
I would advise updating the instructions or tests to reflect the scenario of more than two words. That is an issue.
It would be helpful if you mention in which language that happens. Your first post is too general and could be misinterpreted.
The lack of instructions and tests to account for the tests in "Attempt" will be an issue in any given language.
I am writing this in C# and JavaScript.
Tests in javaScript generate exclusively two words name, as expected.
Tests in C# include names of more than two words.
Edit: When I have time to finish my testing, I will be sure this is accurate.
No (just controlled it).
Edit: + just submitted a solution that would fail if it was not the case + controlled random generator.
You are just wrong...
I've checked too, both tests in javascript and C# are fine.
Yep. You're right. I am wrong. This is not an issue. I'm not sure what was wrong with my code before, but after solving it in both JavaScript and C#, you are correct.
Scala translation
Approved by someone
RISC-V translation Kumited - please accept :-D
Approved!
D translation
Approved!
Completed this kata in python, it was fun! Next, try it in java...
I did this kata in C++. I didn't have a fun time.
In the random tests, it says 200 random tests, but for me there was only one random test case.
Please say which language you are using. I see it's JavaScript (but I had to check on your profile). There are 200 random tests (you could see that by printing the inputs), the log just gives one assertion message (test passed if it's ok, otherwise it logs the first failed test) but it's independent from the number of tests.
Thank you, I was just used to seeing all the tests passed seperately.
This comment has been hidden.
Please...
Kinda missed on the 'Two Word' part of my solution and tried to make for names with many, many names
Kotlin: the solution set up should provide a complete function declaration, with output type, etc. This is a beginner kata.
Fixed.
This comment has been hidden.
Because it's not available in the current version used in this kata.
I coded a function works in my editor in my pc. Even if i made an input and you write two names and i print it to a div when i click. It shows first capital letter of first word and point and first capital of second letter i made it. but here in function i can not pass.
hi and welcome to return the value not print
This comment has been hidden.
Not a kata issue, print returns
None
. It's a problem with your code, fix it.In Kotlin random test failed with this: expected:<[ JZZEBQBIYSPKSCIJOCV]> but was:<[J]> My code seems to be doing the right thing of taking the first letter. It happened only once, i.e. random, please check the tests.
Mine also fails. Seems to be an issue with the tests.
I confirm tests generate invalid inputs see my submitted solution.
? In the tests mine was okay
Fixed.
COBOL translation (author inactive).
approved
This comment has been hidden.
Please don't post solutions in Discourse.
i marked it 'spoiler' i gues
Yes, but still, not the place to do it. If you want to discuss your solution, please use Solutions section.
ok
I seriously need to learn regex. XD
This comment has been hidden.
This comment has been hidden.
It seems the C tests are only checking the function return, but are not checking that the result gets written back into the
initials
array.e.g. this solution should not pass, but it does. https://www.codewars.com/kata/reviews/616efd84628000000128f730/groups/616f3a29ca8e240001dd3728
i dont know if adding that kind of tests really serves a practical purpose. since there is no hassle to guess how much memory you need it is easier to follow the instructions and thus it does not make the kata any easier to be able to allocate the memory yourself.
It's nothing to do with hassle/easiness - it's just that it seemed a loophole to allow a recalcitrant user (me) to deliberately NOT follow those comment instructions and yet still pass the tests. But please feel free to close this issue if you want.
my point is that, since it does not make the kata any easier, there is no point in playing a cat and mouse game to assess the behavior of the user function. the comment is here to guide less experienced codewarriors who would wonder why the function has to return something even though it mutates its input anyway, i added a check for this one, dunno if i'll make this a habit though
Or, if mutated input is what is expected perhaps these kind of Kata should be
void
functions?it is common in C to return a mutated string that was passed in parameter (e.g.
strcpy
,strcat
, and so on) in order to allow function chaining For example:granted, this is less relevant on codewars, but i prefer to write idiomatic C
This comment has been hidden.
Thanks :)
Thanks very much for all these C translations you are doing!
This comment has been hidden.
Fixed.
Kotlin: the random tests generate empty names sometimes.
Fixed.
This comment has been hidden.
Hi. Please use spoiler flag when divulgating elements of solution. A problem with your code is not a kata issue, please mark it as a question and not an issue next time. You need to use the provided name argument, what you do always returns the same result. Also you don't need to call the function inside your code, the tests do it themselves.
Looks like you're from Kazakhstan as well as me) But that's not about the question. I think you've already got the right answer, but a strong wish to help you out makes me to keep on). I think the problem is that you have separated firstname and lastname. I am a newbie as well, but as I understood test checks your code via string that contains both name and surname. By the way, the kata contains small tip: "This kata strictly takes two words with one space in between them.". So you've got to use this tip, because finding space can show the way to the first letter of surname.
Elixir translation.
Forked and approved
Not very hard as for me. But the description confuses. Random tests was unexpected and frustrating. I have completly rewrote my code and accomplished kata, but this was a bad joke. So please add one or two asserts with lowercase and the like to basic test cases.
R translation (author inactive)
:)
This comment has been hidden.
Please, don't post solutions in Discourse.
oh im sorry!!! I thought solution automatically gets set to hidden! That was my assumption. Im so new to this and im trying to figure out how to delete this anwser!!! :(
Don't worry, you can't delete it. You can discuss your solution under Solutions.
how am i suppose to know all possible failures if not mentioned, my assumption was given proper initials, hence I had to rewrite. conditions must be outlined clearly to account for code assertions.
Totally agree, random test was not funny
This comment has been hidden.
Please mark your post as having spoiler content next time. Your assumption that every name will be in titlecase is wrong, and it's taking a space as the second initial (yes, a space capitalized is equal to itself).
This comment has been hidden.
Please don't post solutions in Discourse.
ok. but i can't delete now.
Just don't do it again from now on.
ok. Thank you
This was fun to do!
This comment has been hidden.
don't print the result
Add test cases for words with in all lower case.
No random tests in Go
Coffeescript
Crystal
Julia
Error on Golang: can't load package: package codewarrior/kata: solution.go:3:15: expected 'STRING', found newline solution.go:5:1: expected ';', found 'func'
I understand this is an old kata, that you might not want to change, but would it be a big change to move one of the 'non-sensical' strings from the 'attemp' test cases into the ones shown before attempting?
The explanation doesn't prepare you for that and I feel like most people will start solving for the obvious easier solution.
If there was a test case under the names with a string 'fzFlp bS' it would be much clearer without practically changing the kata at all. Just moving an 'example' of random tests into the preview ones.
Agreed. It could be a valid trap teaching input validation if you also needed to handle null, empty strings, and strings without space, but then it wouldn't be 8kyu. And then the description could use a "WARNING! Some input validation may be required" thingy.
should be clearer now.
This is illiterate! There is always a space between words. After each contraction should point.
Your opinion has been noted, and it's not going to be changed after over four years and over
35 000
solution. Closing.This comment has been hidden.
We can't either. Read the Troubleshooting your solution guide, which includes posting your solution with proper markup to make it readable, and mentioning your language. Help us help you!
Closing.
Also, why does that almost last line say "missing return statement"? Might that be a clue?
Hello! Please help! It says - 'You have passed all of the tests! :)' But when I press 'Attempt' button -> https://gyazo.com/72587480163e6d0da5e0087a2f1df45d What's wrong? I don't get it
Please see if this answers your question: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#when-i-run-tests-everything-passes-but-when-i-hit-attempt-tests-fail
Thanks! I thought that all the tests have to be like 'John Smith', not 'john smith' or random like 'jOhN TenDLer'
This comment has been hidden.
No, it's not a KATA issue. Yes, your code is wrong, and makes the tests suite crash. Consider these inputs:
"george clooney" => "G.C" "xbEfPNUivto MDBxMEDFevCRGVZVmQCVa" => "X.M"
Solved this! It was a pleasant experience, thanks to you! P.S. now i have to realize why test suite crash with my code 🤔 P.P.S. i was have to read the output)
This comment has been hidden.
The function's name is wrong, it should be
abbrevName
. Also, your returned string has two dots instead of one.I realize that my returned string is returning 2 dots instead of 1.
That's what I am having trouble with ^^; any pointers?
Instead of using a loop, try using another method or a f-string.
This comment has been hidden.
This comment has been hidden.
Nobody's going to change the requirements now.
This comment has been hidden.
This comment has been hidden.
Recreate the failing test case locally (see here how) and debug it in your IDE.
On the final attempt some words are all LOWERCASE.
This comment has been hidden.
This comment has been hidden.
If you post your code you need to mark it with a spoiler flag.
Your function needs to return the answer, not print it.
ok, got it!! but i guess i marked it as spoiler
No, I marked it as a spoiler.
This comment has been hidden.
Your function is printing the result instead of returning it.
thanks ive got it
This comment has been hidden.
Your function should return, not print the result.
Hi Madamanchi_Sirisha, please know that you should always click the spoiler tag when you post code. (I have added the tag)
This comment has been hidden.
No, your output has a space and a dot more than needed.
This comment has been hidden.
Not a kata issue, your function should return the result, not print it.
This comment has been hidden.
If you post your with proper markdown (remember to use a spoiler tag), then someone can help you.
I think it would be nice if the test cases also include one of the tricky cases when you attempt to solve the exercise ;)
This comment has been hidden.
This comment has been hidden.
Don't post solutions in discourse, it is forbidden.
This comment has been hidden.
You are supposed
return
the result.Thanks :)
Java Script What am I doing wrong? Why are attempts failing? Test Results: Test Passed: Value == 'S.H' Test Passed: Value == 'P.F' Test Passed: Value == 'E.C' Test Passed: Value == 'P.F' Test Passed: Value == 'D.M' TypeError: Cannot read property '0' of null at abbrevName at /home/codewarrior/index.js:18:19 at /home/codewarrior/index.js:50:5 at Object.handleError
It is very hard to tell from info that you provided. But it looks like you are tryng to read first character of non-existing string.
Check your arrays and first letter reading parts.
you betrayed me :(
This comment has been hidden.
I doubt this should be 8 kyu...
I kinda feel like if there's meant to be a full stop between the initials, there would be one at the end too. Not that it really affects the point of this kata, just an observation.
Recommend that the description include that the answer must be uppercase.
I agree.EDIT: Oh they have done that now, but I suggest that the either sample tests should have lowercase letters like that, the description should mention it, or the lowercase letter thing shouldn't be in full testsfrom the description:
The output should be two capital letters with a dot separating them.
Factor translation ready for review!
The tests should include at least one non-ASCII initial, to break solutions assuming runes are bytes.
This is out of the specs of the kata, closing
Please fix a typo in the description "The output should be two capital letters with a dot sep[A]rating them."
Done.
It would be nice if the description included the need to make the initials uppercase.
Isn't it there?
I did not see it in the initial, perhaps it loaded weird. I figured it out after failing tests, and since rebooting, I can now see the full description. ¯_(ツ)_/¯
Push of my PureScript Translation. I know PureScript is kindof a niche programming language but the PS community would be really happy to offer more ways of learning PS.
I agree with other people. The description could be more specific
I created a PureScript translation. Please review :)
Can someone look at this again? Would be really neat to have it merged: https://www.codewars.com/kumite/5d57d2bb290b0396cd4137dc?sel=5d57d2bb290b0396cd4137dc
This comment has been hidden.
This comment has been hidden.
what? https://gyazo.com/be83cdf0d64f91782873f6229358efd4
Hi rodatboat - Looks like this is c++, which I'm unfortunately not familiar with.
I would guess that this is due to whitespace. Perhaps there's a space or newline after the S.H? Might be worth appending something to your answer, to make it easier to tell.
If it's not that, feel free to post your code (ensuring the spoiler box is checked) and someone will hopefully give you more specific advice.
You were right there was a white space after the initials, I just trashed what I had and redid it and it worked.
This comment has been hidden.
Maybe not all names start with a capital letter?
You appear to be right! ;)
This comment has been hidden.
Print the input using
console.log
.I didn't know that there are lowercase letters too. Solved the problem :)
This comment has been hidden.
Your functions should return in CW, not print the results. Also you don't need to add single quotes to the string.
Thank you!
**The hidden test cases are not correct.
Log MYFT XLAXHRVKAV Expected: 'J.G', instead got: 'MYFT XLAXHRVKAV' Log ZG WYXV Expected: 'Z.K', instead got: 'ZG WYXV' Log OJSKRUZBDXX Z Expected: 'O.L', instead got: 'OJSKRUZBDXX Z'
Are you somehow ignoring lowercase letters? I don't see the issue you claim at the tests.
I converted all letters to uppercase to that in the test that you can see above that what is expected is NOT found at all when you log it. Re-read it again.
Log MYFT XLAXHRVKAV Expected: 'J.G', instead got: 'MYFT XLAXHRVKAV'
***There is NO J or G in that string, is there? No. But it expects it yet it is NOT found. You could not PASS this if you wanted too.
Log ZG WYXV Expected: 'Z.K', instead got: 'ZG WYXV' Log OJSKRUZBDXX Z Expected: 'O.L', instead got: 'OJSKRUZBDXX Z'
Is it javascript we're talking about? Could you post your code and mark your post as having spoiler content? It's easier to see what's wrong that way. If it is javascript, don't do any input manipulation, simply
return name;
and see what the input is and what the expected value is too. They all seem to be ok.Javascript
This is just done right dirty to me to do to people trying to solve katas like this. You specify one thing in the instructions, and you pass all the sample test. Then, all the random test fail. No idea why, or how to resolve it because it doesn't specify in the katas description. There is a metric here to see how many times you get a kata correct on your first attempt, and katas like this are seemingly designed to sabotage that metric.
***Write a function to convert a name into initials. This kata strictly takes two words with one space in between them.
The output should be two capital letters with a dot seperating them.
It should look like this:
Sam Harris => S.H
Patrick Feeney => P.F***
Run Sample Test:
Time: 737ms Passed: 5 Failed: 0 Test Results: Log S.H Test Passed: Value == 'S.H' Log P.F Test Passed: Value == 'P.F' Log E.C Test Passed: Value == 'E.C' Log P.F Test Passed: Value == 'P.F' Log D.M Test Passed: Value == 'D.M' You have passed all of the tests! :)
Then when you do an Attempt:
Test Passed: Value == 'S.H' Test Passed: Value == 'P.F' Test Passed: Value == 'E.C' Test Passed: Value == 'P.F' Test Passed: Value == 'D.M' Expected: 'G.C', instead got: ' . ' Expected: 'M.M', instead got: ' . ' Expected: 'E.D', instead got: ' . ' Expected: 'R.W', instead got: ' . ' Expected: 'F.Q', instead got: 'F.B' Expected: 'K.G', instead got: 'S.I'***
Like, I had katas that confused me, frustrated me, etc. But this one is just straight B.S. to me. If you are going to do edge cases in random hidden test, you should specify something in the description or do one in the sample test.
It seems you're ignoring lowercase letters.
I agree, this frustrated me. Atleast mention that the inititals must be uppercase, and it should be case tested incase some people enter their names in lowercase or random case.
"This kata strictly takes two words with one space in between them."
Tests included two words with dots separating them. Not very strict. :)
Test Case Error on PHP always error on the last in Final Test Case
UPDATE: It's now Working.
Solved then.
This comment has been hidden.
This comment has been hidden.
Not a kata issue, your function should return the result instead of printing it.
The sameple test fails -> Endponint not defined.
The instruction is not complete, it is misleading. You need to look at random test to understand what needs to be done (python).
What's confusing about it? Would you mind suggesting better instructions?
TypeScript translation has been provide. Please review and approve.
Approved
for python am i doing this wrong Tyler Klehm => T.K
In Python sample tests are running as intended, however when I try to attempt it fails. I suggest the test cases are wrong or do not match to the description of the Kata. Please fix it.
Are you sure? 938 people have managed to solve this kata in Pyton :-)
This comment has been hidden.
No one told you the names would be capitalized.
The issue is not about capitalization, the issue is that the Python version signature has two arguments but the test cases only pass the function one argument.
This comment has been hidden.
PHP translation, please check and approve :-)
Done.
Thank you, :-)
Hello! Can somebody tell me please why the method join is not working in this task? Test all passed, only method join is not Test Passed: Value == 'S.H' Test Passed: Value == 'P.F' Test Passed: Value == 'E.C' Test Passed: Value == 'P.F' Test Passed: Value == 'D.M' TypeError: Cannot read property 'join' of null at abbrevName at /home/codewarrior/index.js:20:19 at /home/codewarrior/index.js:52:5 at Object.handleError
Having the exact same problem, don't understand what's going on....
You're probably using
match
, and nobody told you the names would be capitalized or not.Haskell : https://www.codewars.com/kumite/5b5242adf1d55393110000b0?sel=5b5242adf1d55393110000b0
Approved
Rust Translation has been provided
Please review and approve
C++ Translation submitted. Please review and approve.
This comment has been hidden.
Fixed.
This comment has been hidden.
You should provide more details:
Print the name parameter. What does it say?
What is expected/actual test failure?
This comment has been hidden.
@Gautam, I see 2 bugs
Your bug - The Kata description says "The output should be two capital letters with a dot seperating them." (Hint: CAPITAL letters)
The Translator's bug - The test
assertEquals
parameters are reversed so expected/actual are wrong way around. I guess that added to you confusion.Thank you.
FYI - The
Java
assertEquals expected/actual parameters are all back to frontCame here to say the same thing, honoured to be thinking alongside dinglemouse
Fixed.
C++ Translation here. Please review and approve.
This comment has been hidden.
This comment has been hidden.
Java translation added!
@codinghog, see dinglemouse issue above
Fixed! Sorry for my mistake :(
Are you sure it's been fixed? I still see actual and expected flipped after clicking reset several times. If you forked the translation paste the link so any power user can approve the fork.
All tests are fixed. Can you tell me which tests fail?
This is a sample test line. assertEquals("S.H", AbbreviateTwoWords.abbrevName("Sam Harris"));
Still see them the other way around (no matter how many times I click reset).
So it has already been approved. Should I fork it to fix it?
I think so. Paste the link of the fork so I can approve it.
Fixed fork. http://www.codewars.com/kumite/5b3ccef9dfb42903fe000150
Didn't let me approve it right now (I think we'll have to wait a week to properly approve the fork). Meanwhile I copied/pasted the new tests so the issue is resolved. I'm gonna approve the fork next week then. Thank you.
I have the correct output except that they don't have the '' otherwise it is correct.
Edit: I got it to work on how it wants, but only for the first five when I run it afterwards it grabs all other capital letters from what ever hidden test it is running on.
NASM translation submitted.
This comment has been hidden.
This comment has been hidden.
The python version seems to accept anything.
For instance when my function returned "12" for anything, I was told that it was a valid solution.
holy fuck, yes... x)
that has been corrected. Other questions/issues still pending for a decision of the author/translators.
The output should be two capital letters with a dot seperating them.
-> in the description but never tested (at least in python). So either remove that or impleent actual cases with lowercase letters/names
Seems to be fixed in python
In ruby flip the
Test.assert_equals
arguments, as atm it reports the inverse of what's expected on failure.Fixed
Can you consider approving this C# translation? The fork just fixes the merge conflict in the description.
C Translation kumited. :)
I agree with the other posts. When you try to submit the solution one of the cases supplied will fail as it is expecting lower case initials when the requirements and example test casses clearly state that the required output is all upper case. It passes all the example cases. The issue only appears on submit when you see it was expecting "g.c" but instead got "G.C". Can you please repair the broken test case so that we may submit?
I also hardcoded the g.c solution and after it got past that it choked on expecting m.m when it got "M.M". The issue is in the random tests that happen on submit. They appear to be backwards.
sorry that was super retarded. i was going to leave it as easy as possible and not include the forced caps part but apparently what i said and what i did came out backwards. Sorted to amend tests so it just goes with the description. thanks a lot
Instructions say the output should return "two capital letters" with a dot seperating them, however your tests expected to return the same casing as the initial name parameter.
The description reads '... The output should be two capital letters with a dot seperating them. ...'.
One of the submission test cases, however, is "george clooney" with an expected response of "g.c".
C#-Translation kumited!
https://www.codewars.com/kumite/57eae7a475ae11d3f9001312
Please check and approve it! :-)
Thanks brother. I changed it to actually requiring capitals so i think your solution needs ot be revised. Sorry for being a pian.
Sorry for the late respond. It is really a problem with the CodeWars-notification-system...
I changed the translation to your new requirements.
Please check again. :-)
https://www.codewars.com/kumite/57eae7a475ae11d3f9001312
Please check again. ;-)