Ad
  • Custom User Avatar

    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!

  • Custom User Avatar

    @lelliott1960,

    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?

    I wrote the Python translation and after re-checking the tests, they seem to be working fine I 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.

    Sometimes people might forget to capitalize the first letter of their name so your function should accommodate for these grammatical errors.

    This line mentions that sometimes people "forget to capitalize the first letter" aka the first character might be a lowercase letter as well.

    If the first character of either of the names given to the function is not a letter from A - Z, you should return "Your name must start with a letter from A - Z."

    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.

  • Custom User Avatar

    @kevin.du,

    Python random test cases are not working for me either though my code works in an IDE.

    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 fine I 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.

  • Custom User Avatar

    @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

    If the first character of either of the names given to the function is not a letter from A - Z, you should return "Your name must start with a letter from A - Z."

    Your solution does not account for this possibility at all. Maybe this example test case will help you understand.

    alias_gen('123', 'Pinkman')
    
    # This is the error that appears on the left, you are not even getting to the Random Tests
    
    STDERR:
    
    Traceback:
       in <module>
       in alias_gen
    KeyError: '1'
    

    The error is because the first character of '123' == '1' but that key is not in the FIRST_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! :)

  • Default User Avatar

    Python random test cases are not working for me either though my code works in an IDE.

  • Default User Avatar

    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?

  • Custom User Avatar

    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.