Ad
  • Custom User Avatar

    Hi Steffen,
    No, I still have it at "very" satisfied because I did learn a lot from this kata and I appreciate that.

    And also... I think you are right! The error message is wunderbar. It was my interpretation of it which was wrong. I see indeed, now, that when I run the "count_visible.." func with an empty string "", then it returns "1" instead of "-1" like it should. I'm new to codewars, and didn't know that "1 should equal -1" means that my output was 1 and should be -1... I thought it meant that an input of 1 should equal an output of -1. Thank you for being really responsive to this thread- sorry for taking up your time! I'll be happy to buy you some beers or something if you ever visit Colorado.
    Cheers! Lance

  • 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'm getting similar problems- I think my code works fine with my test cases...I'm doing it in Python and it seems to be roughly that for every addition of 5 numbers, an additional low number is not summed. Also I got this wierd error:

    example1:

    Random tests

    Testing for [29, 835, -104, 93, 10, 65, -324, -361]

    7

    ✘ It should work for random inputs too: -428 should equal -94

    so with 8 numbers, it is dropping the lowest 2

    example2:

    Random tests

    Testing for [985, -7]

    1

    ✘ It should work for random inputs too: 978 should equal 10000000000984

  • Custom User Avatar

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

  • Custom User Avatar

    I've marked "very" satisfied now. Sorry- I wasn't trying to be a jerk.

  • 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?

  • Custom User Avatar

    Below are the parts of my old code that was raising misleading errors:

    if characters == None:
        return None
    if characters == empty:
        return empty
    characters = str(characters)
    if type(characters) == int:
        return ""
    

    ... and then for the 'count' methods I had it return -1. Therefore, as you can see, if your testing program were to input (1), then I would output (-1) and yet the error message only said "1 should be -1"
    I'd be happy to give a positive ranking if the error message becomes more helpful.

  • Default User Avatar

    Is this why you gave a negative ranking?

  • Default User Avatar

    Issue?
    Where is the problem?

  • Default User Avatar

    So, all is fine and you solved it? :-)

  • Custom User Avatar

    I struggled with this a lot as a noob (in python) because I got some misleading error messages
    (Before I learned I should do if (not characters): return characters (or-1)...)
    For instance, if I made my output -1 when the input was an int, it would say "1 should be -1" even if an entry of 1 really did produce -1.
    Similarly, sometimes it said "-1 should be '' ", even if I were to make it so that an input of -1 really did give ''.
    I'm guessing what happened is that your test would test for an empty string '' and then somehow the error message was "1 should be -1" or something. If possible, it would really help future codewar participants if you could use the same language in the error messages as you did in the kata description. (ex "empty string should return an empty string for viewing and -1 for counting funcs").
    I'm happy to email you some of the submissions I was getting odd error messages, if you think it is worth the time. My email is in my github acct /lanceculnane

    Other than that, I really enjoyed this kata- thanks! I finally got it after I did if not characters: return characters!