Ad
  • Custom User Avatar

    This code wouldn't work correctly if the sampling rate for the bits is high enough to expose the slight variations in timing that a human generating morse code would naturally make.
    So this code only works when the sampling rate for the bits is low and the bit string has no slight variation in timings dots, dashes, and the gaps between dot and dashes and spaces.
    For example, if the sample rate is high enough that the dots are sometimes 20 1's long but sometimes 21 1's long (which would happen regularly with a human sending morse code) then this code won't
    decode the bits correctly.
    Same thing if a space was sometimes 140 0's long and sometimes 139 or 141 zeroes zeroes long: this code wouldn't work correctly.

  • Custom User Avatar

    This code wouldn't work correctly if the sampling rate for the bits is high enough to expose the slight variations in timing that a human generating morse code would naturally make.
    So this code only works when the sampling rate for the bits is low and the bit string has no slight variation in timings dots, dashes, and the gaps between dot and dashes and spaces.
    For example, if the sample rate is high enough that the dots are sometimes 20 1's long but sometimes 21 1's long (which would happen regularly with a human sending morse code) then this code won't
    decode the bits correctly.
    Same thing if a space was sometimes 140 0's long and sometimes 139 or 141 zeroes zeroes long: this code wouldn't work correctly.

  • Custom User Avatar

    It also doesn't say anything about having lists. (Python version)

  • Custom User Avatar

    Yup, I know what I did to cause it (issue with my code not the kata), (not used to this CW thing).

  • Custom User Avatar

    Thanks, I thought it was an issue with the Kata because of how/when it was ocurring...

  • Custom User Avatar
    1. language?
    2. python seeing your profil...
    3. not an issue, a question
    4. the problem is in YOUR code, not in the kata (that's why it's not an issue), so handle it (it's the very goal of CW!)
  • Custom User Avatar

    Error with the def (It reports an invalid syntax) - It means I cannot submit my solution

  • Custom User Avatar

    The first line of the tests comes after the last line of your code, so the error most likely originates there.

  • Custom User Avatar

    When attepting this Kata there is a santax error when importing the random module

    from random import randint
       ^
    santax error
    
  • Custom User Avatar

    Couple of things I suggest is to change your variable names for example, instead of n_t a more sutible name for it could be number_of_thousands or Num_thousands this would help the read ablility of your code.

    Anoughter possible change could be to use the digits location and the length of the inputed number (By which I mean the length (len()) of str(178) (which equals "178") is 3 (meaning 3 digts)

    Good luck with making improvements! (also commenting code is a good idea)