8 kyu
Hex to Decimal
338 of 31,765wichu
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.
If you know, you know. If you don't, then you'll never figure it out on your own.
Lua translation!
Approved
i actually found it difficult for me
C fork
Approved
RISCV Translation
C# peeps who are new might need a little creativity, but fortunatly the test cases are really good and you will pass if you can make it through them.
i tested my code and it's working for every hexadecimal i tried but my answer can't pass your tests. language used is python.
Your code is wrong, index returns the first occurrence in the string, so your code fails when there is a repeated digit in the hex number. Not a kata issue.
hmmm.... difficult for someone who doesnt understand hex numbers.
D translation
Approved!
Go translation
Rust translation
approved
Not a very good description; should be expanded
I agree! I wonder what exactly does the string look like...
COBOL translation.
approved
Not all languages require to handle negative numbers. This should be stated in the description and unified.
This comment has been hidden.
This comment has been hidden.
id like to ask you again to read how to use code blocks. Did you read the link on code formatting I posted in one of your previous questions? here it is, once again: https://docs.codewars.com/references/markdown#code-block
The line you show has a syntax error and unmatched parentheses.
Typescript 3.3 or above should be enabled
Fixed
I can't run the test in C#, because it can't handle the "Char."" methods.
Your request is not clear, and in any case it's not a kata issue.
No random tests in F#
Please, can you give more details about the exercise? Like what's a hex and a decimal number? What are examples of translating from hex to decimal?
Hey! 'hex' if for hexadecimal numeral system. While decimal numeral system goes from 0-9 (if you count from 0 to 9 you will find out that there are already 10 numbers. In decimal numeral system the last digit that is equal to '9', so the very next number will be '1'+0, '1'+1 and so on.) The hexadecimal numeral system goes from 0 to F (16 numbers) here is the first +32 digits: 0 1 2 3 4 5 6 7 8 9 A (is equal to 10) B C D E F (is equal to 15 in decimal ) 10 (is equal to 16) 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 and so on Hope it helped you out
This helped...now the question is...
But why?
What do you mean "but why"?
Outstanding!
That description is really descriptive
This comment has been hidden.
Not an issue. Select correct language version.
Racket translation
Some languages have only uppercase A-F, some only lowercase, some both. Requirements should be specified and unified.
I fixed my translations to have uppercase letters too.
Modified random tests in the Racket translation to generate both upper and lower case hex numbers.
Also added "Make sure your function can handle both upper and lower case hex numbers." to the instructions.
Do these changes (at least for Racket) satify your concern?
PHP translation kumited.
Julia translation kumited.
Dart translation kumited
Approved
Please, NASM Translation
Approved
Great!
Description can be expanded. Might be a good idea to explain that both uppercase and lowercase letters can be passed.
I don't fully understand the error messages I'm getting :(. Besides that, the line number where the errors occur are missing, I believe. Can somebody help me out a bit / give me some hints?
Can you guys see my code btw, or do I have to post it. If so, where should I post it? (I'm a rookie here.)
You should do
std::cout <<
to display the input, output and any intermediate values you've used.Also, seems like you've solved it, closing!
This comment has been hidden.
The F# tests expect floats. This doesn't make any sense. Should have been ints.
This comment has been hidden.
You maybe fogot to add a rule not to use built in function ? ))
TypeScript-Translation kumited!
https://www.codewars.com/kumite/581a1502c6c358f323000bb2
Please check and approve! ;-)
Translated to
Java
. https://www.codewars.com/kumite/5819dac0ba1a0ea34c000e47?sel=5819dac0ba1a0ea34c000e47:-)
Pending your approval...
Aproved
I would suggest giving an appropriate class name for the Java version, for example - class HexToDecimal.convert(String). If you have a local collection of your own kata solutions (for example all solved kyu8), it comes into conflict with other code challenges where an author has declared the same name.
C translation kumited! :)
Good kata, but shouldn't this be asking for hexadecimal, not hex?
What's the difference?
C++-Translation kumited!
Please check it and approve. Thnaks! ;)
C#-Translation kumited!
https://www.codewars.com/kumite/57a8b4db72292db1370002bd
Please check and approve!
Ruby and JS translation submitted :)
Python translation kumited.