Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Hey "lanceculnane". :-)
    And now you changed it back to "Something"? Why?

    I think the error message is really full correct. The value should be equal to -1. Your value is 1. So it is wrong. In the description it is said, that -1 is expectet in the cases of empty and null. So where is the problem?

    You have had fun and a good challenge with this kata. So give a "very".
    If you think, it was a bad and stupid kata, then give a "stupid" or "bad". But be honest and fair and do not a revenge voting, because your thoughts about the error message are not like mine and like the others.

    Have fun at codewars. Learn. And become a wortful member of the great codewars community! :-)

  • Custom User Avatar

    I laughed way too hard at this :D.

  • Custom User Avatar

    @lanceculnane,

    I did the Python translation for this kata and would try to help explain/fix any problem but your issue description is so vague that I don't know what you mean. The katas description clearly states:

    If the string is null or empty, you should exactly return this value for the watch-methods and -1 for the count-methods.

    • For the watch functions:
      • If the input was None, you are expected to return None (null is equivalent to None in Python)
      • If the input was an empty string '', you are expected to return an empty string ''
    • The count functions will only ever return -1, if the input string is None or an empty string ''.

    Also, Your code example makes no sense to me? The input argument for the two count functions is a single string of characters or None, not an integer.

    if characters == None:  # if you want to do this in Python, you should use 'if characters is None:'
        return None  # this is supposed to return -1
    
    if characters == empty:  # where does this 'empty' variable come from? do you mean "if characters == '':" ?
        return empty  # this is supposed to return -1
    
    characters = str(characters)  # characters is already a string (and if it was None, it would have been caught above), why would you want to convert a string into a string?
    
    # if you turn 'characters' into a string in the line before (even though it's already a string), why are you now checking if it is an integer?
    if type(characters) == int:   # you should use 'if isinstance(characters, int):'
        return ""  # this is supposed to return -1
    

    I would try to help if you can be more specific about your problem. By specific I mean:

    • Post the exact solution code that you were using when you got this error (I mean the whole thing, all 4 functions)
    • Post the exact error that you received and specifically what you don't like/understand about it
    • If you do this, make sure to check the box Mark as having spoiler content underneath your comment (so you don't give away the solution to other users)

    Thanks!

  • Default User Avatar
  • Default User Avatar

    you gave a negative ranking because you do not like the error message?
    are you serious?

  • Default User Avatar

    I don't see where is the problem...
    What is your concrete problem?

  • Default User Avatar

    Is this why you gave a negative ranking?

  • Default User Avatar

    Issue?
    Where is the problem?