Ad
  • Custom User Avatar

    I had the same code as the owner of this post. Thank you for noticing this loophole. I think it was not considered by the creator of the Kata when the checker was coded.

  • Custom User Avatar

    Indeed, this would fail on some cases. Probably because the test were not tight enough 2 years ago, one of them being

    String: ", . pears\nlemons\nbananas ' watermelons = ! watermelons"
    Markers: []
    
  • Custom User Avatar

    I thought so too at first, but since we are iterating over every mark in the inputs it will eventually split the string on the leftmost marker.

    If this wasn't true, than some the tests would fail.

  • Custom User Avatar

    Thanks for your feedback!
    I have not read the condition carefully.
    I really thought that the condition is imposed on the input parameter, and not on the result.
    The fixed solution is here:

    https://www.codewars.com/kata/reviews/5b86545bb80ee00ca6000358/groups/5fa7cc73a3c4740001e6a6f8

  • Custom User Avatar

    I understand what you mean.

    Actually, I did the re-assignment to the input.

    '#'+s.title().replace(' ','')
    

    s in the above part is still the input.


    s='#'+s.title().replace(' ','')
    

    first s in the above part is the output.


    return s if s!='#' and len(s)<=140 else False
    

    all vairable s in this part are not the input (it's already assigned to new value). Those are the output.


    Sample Test

    you can add this test to the smaple tests. It will work properly 😉.

    Test.describe("Basic tests")
    Test.assert_equals(generate_hashtag('codewars                                                                                          is                                                            nice                                                                                '), '#CodewarsIsNice', 'Should deal with a whole lot of spaces.')
    

    Hope this clear to you.

    Thank you for checking my code 😊

  • Custom User Avatar

    That is great! You open my mind!

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

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

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

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

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Custom User Avatar

    Your code us clear. But I think the program description is the result larger than 140. The input is not. Since the input contains many spaces , the input is always larger than the result. So , although input is larger than 140 , the result may not larger than 140. So , your code does not work welll if the input is larger than 140 while the result is not.

  • Loading more items...