Ad
  • Default User Avatar

    Could you please explain the following line: "for j in range(1,int(i**.5)+1):" ?

  • Default User Avatar

    I just wanna say this is a beautiful and clever implementation , 100x faster than mine lol.
    I love it how you came up with the range for the 2nd for loop to be up to i**0.5 this is so efficient.
    So, if i is 1024, you only loop from 1 to 32 and then you get the other numbers by dividing 1024 by (1,32).
    In my case I would go all the way to 1024 in the loop, lol.
    When i tested my solution for (1,30 000 ) it takes 44s, lol, where as yours takes 0.4s :D

  • Custom User Avatar

    You should usually use a regex (which you might consider more of a stand-alone language than a style) inside a piece of code; here my testing code does that for you :)

  • Default User Avatar

    hey there,
    i am very new to this regex style of programming, so i need some help out here.
    What i don't understand is how can i give input to the parameter when i am not calling a function?
    ex: regex=re.search('blah*',name)
    from where do i get this name parameter..

    P.S. i am sorry if my question is a bit messy

  • Default User Avatar

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

  • Default User Avatar

    this is not related to this kata...its a general question
    i wanted to ask how can we get to know the number of honor we will receive to solve a kata
    for example when i solved this kata i received +1 honor
    whereas in my previous solved kata i receivd more than 10 honor

    thanks:)

  • Default User Avatar

    Yes spaces not zeros...that was the whole confusion
    Anyways the kata is solved now
    Thanks:)

  • Default User Avatar

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

  • Default User Avatar

    use MORSE_CODE['....'],it will return 'H'

  • Custom User Avatar

    Sorry, I thought this comment was for my another kata, so I answered unadequately. Mea culpa.

    Also, thanks for finding a bug in the wording - it should be "extra spaces handling", not "extra zero handling". For some technical reason I can't edit the Test Cases any more (simply can't type in that window), @jhoffner, could you please make this replacement for me?

    So, @Rohan.ag, the problem is about some extra spaces at the beginning and the end of the input - it is mentioned in the kata description, check it.

    As for knowing the input, it's very simple - just print it. :) But not that console output here on CodeWars is HTML, so remember to wrap everything you print in <pre> tag to not miss anything important like extra spaces. :)

  • Custom User Avatar

    The JavaScript version could include instructions on how to access the morse code library.

  • Default User Avatar

    thanx for a quick reply :)
    but how come there are 0's when here everything is about . and -
    and
    is there any way i ccu know what is the input of the test case where my code is going crazy :p

  • Custom User Avatar

    "Extra zero handling" message means your code doesn't take proper care of extra 0's at the beginning and end of message.

    "cannot concatenate 'str' and 'NoneType' objects" message means that somewhere in your code you do a + b, and in some situation a happens to be a string and b happens to be a None.

    What you're probably missing is that your code may work differently on different input data. :)

  • Default User Avatar

    after 9 test getting successfully passed , i am getting a message "extra zero handling"
    and also an error :cannot concatenate 'str' and 'NoneType' objects

    what am not understanding is that if there's a problem in my code then the test should fail in the first case itself...why is it taking 9 test cases to check??
    is there something that am missing?

    language used: python
    P.S. i had received this error while running test befre submitting but that time i had solved it