Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
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.
It also doesn't say anything about having lists. (Python version)
Yup, I know what I did to cause it (issue with my code not the kata), (not used to this CW thing).
Thanks, I thought it was an issue with the Kata because of how/when it was ocurring...
Error with the def (It reports an invalid syntax) - It means I cannot submit my solution
The first line of the tests comes after the last line of your code, so the error most likely originates there.
When attepting this Kata there is a santax error when importing the random module
Couple of things I suggest is to change your variable names for example, instead of
n_t
a more sutible name for it could benumber_of_thousands
orNum_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()
) ofstr(178)
(which equals "178") is 3 (meaning 3 digts)Good luck with making improvements! (also commenting code is a good idea)