Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Sorry guys, after reading through my test case code and solution again I realized I forgot to convert lowercase to uppercase (for the first characters). The solution code should now be fixed.
That still doesn't do anything about the early submitting error on Codewars but might help answer some of your questions (hopefully?).
Thanks for the feedback, it helped me find and fix my error!
@lelliott1960
,I wrote the Python translation and after re-checking the tests,
they seem to be working fineI may have found the error (described at the bottom). But the kata is not only testing if the first character is capitalized, it's checking whether the first character (of both the first & last name) is alphabetic.This line mentions that sometimes people
"forget to capitalize the first letter"
aka the first character might be a lowercase letter as well.This line mentions what to return if the first character (of either name) is non-alphabetic.
If you post your solution code I could take a look at it and try to help (if you do, make sure to
Mark as having spoiler content
)EDIT:
I made a mistake and didn't convert the lowercase first characters to uppercase, that may have been what was messing up your results. Please try again and let me know if that fixes the problem for you.
@kevin.du
,I'm not sure what you mean about the random test cases not working. I wrote them and just tested them again and
they seem to be working fineI may have found the error.If you post your solution code I could take a look at it and try to help (if you do, make sure to
Mark as having spoiler content
)EDIT:
I made a mistake and didn't convert the lowercase first characters to uppercase, that may have been what was messing up your results. Please try again and let me know if that fixes the problem for you.
@nick2ufree
,Hey, I just saw your comment now and your solution is incorrect. The reason it is able to be submitted is because of an issue with Codewars itself.
https://github.com/Codewars/codewars.com/issues/465
Your solution does not account for this possibility at all. Maybe this example test case will help you understand.
The error is because the first character of
'123' == '1'
but that key is not in theFIRST_NAME
dictionary. Your solution has to account for that.Even though that error appears in the output section, the submit button is now green and allows you to submit. This isn't an error with my test cases, it's an issue with Codewars itself.
If you REALLY pass all of the tests, there will be a message at the bottom of the output section saying
You have passed all tests! :)
Python random test cases are not working for me either though my code works in an IDE.
With Python v 2.7.6, I have the same result as nick2ufree above. I believe my code does test for first letter not capitalized and also if names contain numbers anywhere in the name...can anyone with python experience check on this?
The random tests introduce two new difficulties. Firstly some of the strings include numbers, if the first letter of the name is a number it needs to trigger the "Your name must start with a letter from A - Z." message. Secondly it tests strings where the first letter is not capilalised so your function should capitalise the string. If this doesn't work and you are trying in JavaScript I can look at your code and try to help you that way.