8 kyu
Correct the mistakes of the character recognition software
21,239 of 67,834denesnori
Loading description...
Fundamentals
Strings
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.
Perl translation
I think this should be rated 7 KYU
The class name should be
BasicTests
andRandomTests
, notBasic Tests
andRandom Tests
according to Ruby Style GuideAlso why is
Basic Tests
spelledBaisc Tests
these are not classes, they are the names of the tests groups
Fun and challenging problem! Great for practicing string manipulation and logical conditions.
Would recommend for beginners looking to strengthen their understanding of case handling in strings.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Your code only replaces the first occurence of each number.
OP solved it, closing
This comment has been hidden.
The issue tag is for issues with the Kata itself, not problems with your own code!
This comment has been hidden.
Issue with your code is not a kata issue, closing.
This problem is not correct becasue i am testing my answer on VSCode it is giving me the correct answer as well as in the log of Kata is also correct but it is giving me error i don't know how to solve the issue
The problem is fine, your code is wrong.
the code seems to work on SWI-Prolog but not online. Did I make a mistake concerning the return type?
This comment has been hidden.
This comment has been hidden.
Read the posts below: https://www.codewars.com/kata/577bd026df78c19bca0002c0/discuss#633918a2198a4c00166ab324
Add a two words sample test for every language, see the "not issues" below about
"IF-RUDYARD KIPLING"
I too have encountered the problem that n this test case (IF-RUDYARDOKIPLING should be IF-RUDYARD KIPLING). But i cant see specification about this situation ? What i do wrong ?
Your code is wrong, not a kata issue, print the input and check why it fails. Read this: https://docs.codewars.com/training/troubleshooting
It'll also fail with this input:
"HELL0 W0RLD"
There is a something wrong or a problem in this test case (IF-RUDYARDOKIPLING should be IF-RUDYARD KIPLING) so why ?
Your code is wrong, not a kata issue. The tests are fine.
This comment has been hidden.
That's because it requires a Node's version that's not available yet in CodeWars.
'IF-RUDYARD KIPLING' what is this stupidness :(
decent
This comment has been hidden.
OP solved it, closing
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
That's because it requires a Node's version that's not available yet in CodeWars. Not a kata issue.
So I passed all the random test but getting this for fixed test....am I wrong reading this in that it wants me to remove the O even though we are suppose to be replacing 0 with O?
expected 'IF-RUDYARDOKIPLING' to equal 'IF-RUDYARD KIPLING'
This comment has been hidden.
This comment has been hidden.
It requires Node 15 which isn't available in CW yet.
There is 100% a bug in the C RandomTests suite.
The bug is that it expects the input string to be modified in place, and it ignores the return value of your "correct" function.
There is no equivalent bug in C++, nor is there an equivalent bug in the C BasicTests suite.
This requirement is not stated in the problem, and is unique to one specific test suite in one specific language. It's a bug.
The workaround to meet this secret requirement is that you need to overwrite the input string with the result, before you return the result. That way, the broken RandomTests suite passes.
In the solution setup, under the declaration, there is this comment:
Granted, this is not the same as C++ or maybe any other language, but this comment explains exactly what to do. So, in fact the random tests are working correctly. This confusion arises instead due to all other tests, because they test a fresh string literal against whatever your return, whether you complied with the directive given in the comment or did something else.
In python everything work execpt for the number 5. 5INGAPOR and PARI5 doesn't work but it work for BUDAPE5T. I try my code in my editor and it works fine. Maybe it's because of the position of the number (first and last)? I try to isolate them, again work in my editor not in the kata... Anyone has the same issue? Maybe I made something wrong?
Hi. It's very likely you do something wrong indeed. This kata has been solved by thousands of users without problem. Hopefully this recommandation page may help you: https://docs.codewars.com/training/troubleshooting/
This comment has been hidden.
Prolog translation
Coffeescript translation
R translation
Typescript translation
(author inactive)
Thanks :)
Testing for fixed tests expected 'IF-RUDYARDOKIPLING' to equal 'IF-RUDYARD KIPLING
Is it a correct test?
ya me too getting the same issue in the instructions it says we only have to check for few conditions
Yeah I am getting the same issue as well. My code is working absolutely fine on my editor.
For NASM you should specify that the string is to be modified in place and returned.
This comment has been hidden.
fun kata!
In C version it should be noted that returned string is a mutated input string, not a copy of it.
If string is copied via
strdup()
, random tests are failing.At the very least having the basic tests behave the same way would be nice.
It's a bug, there's no question about it.
This comment has been hidden.
There is 100% a bug in the C RandomTests suite.
The bug is that it expects the input string to be modified in place, and it ignores the return value of your "correct" function.
There is no equivalent bug in C++, nor is there an equivalent bug in the C BasicTests suite.
This requirement is not stated in the problem, and is unique to one specific test suite in one specific language. It's a bug.
The workaround to meet this secret requirement is that you need to overwrite the input string with the result, before you return the result. That way, the broken RandomTests suite passes.
This comment has been hidden.
Your switch is wrong, and they are chars, not numbers. There is another problem with it, but I'll let you to figure it out yourself.
OP solved it, closing
C++ bug with number 1 to letter I
Sorry, but what's the issue exactly? I've passed the kata and I can't find it.
This comment has been hidden.
That's a problem with your code, not with the kata. Expected value is ok, what's wrong is what your function returned, if you want some help, post your code and mark your post as having spoiler content.
'J. K. ROWLING - HARRY POTTER AND THE PRISONER OF AZKABAN' should equal 'J. K. ROWLING - HARRY POTTER AND THE PRISONER OF Azkaban'
Why only Azkaban is in small letters??
Don't convert a string to uppercase when you're not asked to?
This comment has been hidden.
Why is this an issue? None of those letters is one of the three you need to check for. So you can left them as they are. I know you say for consistency, but nowhere it says all letters are going to be capital ones.
Not an issue.
Racket translation
Julia translation
Java Fixed Test Sets Improvment.
Hello, there. The javascript translation of this kata has a error. The comment syntax is incorrect. It's a slash rather than backward slash.
Fixed.
In Python when I run my code for both sample test and attempt I get: NameError: name 'correct' is not defined
I tried all samples in ipython and it works but cannot finish here due to this error.
That's a problem with your code, is your function's first line like this?
Otherwise, either click reset or edit it.
I am an idiot. I was working in ipython and for some reason defined replace() instead correct().
Thanks for reply though :D
Scala translation
Please check and approve! thks!
Approved by someone
Hi, I made a NASM translation for this Kata.
Approved
Java translation added!
PHP translation
Please check and approve! :-)
This comment has been hidden.
Your function should return, not print the result. Mark your post as having spoiler content next time and use proper markdown
will do thank you
At this point, I am quite sure that there is a bug in the random tests that are done.
Everytime I try to submit my solution it fails on some random test. For the sake of completeness, I add that failing test case to the set of sample tests given. When I do that, the code miraculously passes the very same test.
I don't know how this could be a bug with anything other than the random tests. Is this possible to have fixed? -- I am doing it in C by the way.
Otherwise, it was a fun kata!
I highly doubt there is a bug in the random tests.
But nonetheless which language are you using, provide the test cases you are failing on (one or two will suffice if they are of same type) and provide your code marked in spoiler tags so someone can take a look
This comment has been hidden.
Nope, Random tests are not broken.
I can confirm that. Since I did it myself just to confirm that. There is something wrong with your code.
I will give a hint if you want.
This comment has been hidden.
Nope, its all good.
Congrats on solving it :)
This comment has been hidden.
@ggolren :
Okay
I'm currently having the same problem.
Any insight as to what you did to fix it?
This comment has been hidden.
I'm doing it in C and have the same exact issue. Not sure what's up.
There is 100% a bug in the C RandomTests suite.
The bug is that it expects the input string to be modified in place, and it ignores the return value of your "correct" function.
There is no equivalent bug in C++, nor is there an equivalent bug in the C BasicTests suite.
This requirement is not stated in the problem, and is unique to one specific test suite in one specific language. It's a bug.
The workaround to meet this secret requirement is that you need to overwrite the input string with the result, before you return the result. That way, the broken RandomTests suite passes.
This comment has been hidden.
You're using
str.replace
incorrectly.Haskell translation done, let me know if there's any problems with it.
I don't understand I've ran my solution in codecademy's editor and runs fine, in the kata stays l0nd0n should equal london
Your code isn't converting
0
too
yes that's the kata convert 0 to o.... What I dont understand is why it runs in python on the raspberry pi and on codecademy
Can't tell without seeing your code, but I have just solved it in Python and worked fine for me.
Crystal and c++ translations kumited;
Ruby translation please check and approve :-)
Approved!
C translation kumited! :)
Done
C# Translation kumited.
https://www.codewars.com/kumite/5792b1447cb7a172ba000016
Please check and approve it!