7 kyu
Insert dashes
5,051 of 9,068joh_pot
Loading description...
Strings
Arrays
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.
Simple task, simple solution.
for JavaScript console.log() wasnt working to debug and my for loop was not compiling. Code compiled fine on replit.
That's a problem with your code, not a kata issue. Numbers have no length. You must be passing a string as input in replit.
Thank you boss for helping out this code newbie, that was exactly my problem, easy fix.
C++ Translation
"Don't count zero as an odd digit."
Just curious, why does this need to be said?
So people don't accidentally count 0 as an odd digit and fail to understand why their solution isn't working?
0 is an even number, hence the question.
"Among the general public, the parity of zero can be a source of confusion."
So once again I submit, "so people don't accidentally count 0 as an odd digit and fail to understand why their solution isn't working?"
Written like that, you can either think it is an even number or that it is an odd number but you shouldn't count it, which is wrong. Either say it is an even number or mention the odd digits if you need clarification.
Thanks for presenting a valid solution to the issue
Thanks for the reply. I honestly don't remember ever hearing of people thinking 0 would be an odd number. I suppose there could be a question around it for people new to math and coding. But yeah, if it needs to be clarified, they might as well go ahead and list all the odd digits.
No worries. I mean, it's not wrong... 0 of course shouldn't be counted as an odd digit. Just a bit humorous.
I removed it. This precision doesn't make sense, if we suppose people might not know what even digit is, we should give the whole list of them, but it seems too much (if someone doesn't have clear what an even number is, he can just check it).
Description should be language-agnostic
More well-structured and formatted example tests should be provided
done
Python update (new testing framework)
Approved!
COBOL translation.
C translation (author inactive)
thanks :)
For clarity purpose, you might want to change
numbers
todigits
Digit or NumberDigits are symbols from 0 - 9. The number 1521 are written with 4 digits: 1, 5, 2, and 1.
Although a digit is also a number. using "digit" in this case is clearer and more specific.
fixed
"...Write a function insert_dash(num) / insertDash(num) / InsertDash(int num) that will insert dashes ('-') between each two odd numbers in num. For example: if num is 454793 the output should be 4547-9-3. Don't count zero as an odd number..."
Why not 45-4793? Or 45-47-9-3? etc
Do you know what odd numbers are, don't you? The dashes separate them:
7 and 9 and 9 and 3 are the only pairs of odd numbers next to each other there.
You do know how to answer a question without being a dick, don't you?
Chill bro, no need to be harsh.
Ruby 3.0 should be enabled.
fixed
🤮
The description should say that the integer is non-negative!
Done.
Positive isn't mean non-negative.
Feels a bit more like a 6! Still, cool one, still working my way through it
Java initial solution has some problems
public static class Solution
return "":
Oh wow, can't believe I missed that. Usually run it on both solution and setup before publishing.
I can't edit it now it's been approved :(
I can though. Fixed.
Java translation added!
FYI - typo in Java initial solution
return "":
Hi, I made a C# translation for this Kata, please consider reviewing and approving this.
Thanks mate, approved
I would possibly rephrase the question to: "....that will insert dashes ('-') to seperate odd digits in num.
fixed
In the python description, the function is called
insertDash
, but the tests call forinsert_dash
fixed
There is a typo in Python tests:
assert_Equals
should beassert_equals
.Fixed, thanks; if you have the old version, just paste as sample tests:
resolving issue
Translated this one too :)
CoffeScript translation submitted, please approve. Nice kata, thanks.