6 kyu

Decode the Morse code

4,286 of 120,878jolaf
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • ChanKute Avatar

    It took longer than I thought to solve this problem. Im glad I did it tho ^^

  • ASM.teleco Avatar

    You have to be kidding me. Seriously? I didn't need to make the programming for which combinations of .s and -es mean which character?!

  • ASM.teleco Avatar

    Could you specify what's the relation between patterns and special characters?, because your tests don't seem to use the characters shown in the International Morse code binary search tree as shown on the link you provided.

  • ejini战神 Avatar

    No random tests in Java

  • Just4FunCoder Avatar

    This comment has been hidden.

  • CornSnek Avatar

    For those doing this, especially in C, make sure to read the first 'NOTE:' carefully. Lots and lots of debugging happened because of overlooking that part.

  • tchaflich Avatar

    Typescript tests show <pre style='display:inline'>Got ' E E', expected 'E E'</pre> (that is, they show the raw HTML and not an inline pre element)

  • Kvitt0 Avatar

    How downlooad MorseCode? Where is link?

  • Uoao1808 Avatar

    who added the std::string decoded in c++ ? It does nothing

  • the3rdProspect Avatar

    Despite passing the tests I get a 'Cannot invoke "String.isEmpty()" because "str" is null' error when I attempt. I didn't have a String named str but I made an empty one, same thing. Can't see the tests throwing the error so I'm not sure what I can do to find what isn't working. Training in java 17 if that makes a difference.

  • SGNILC Avatar

    This comment has been hidden.

  • Avalakx2 Avatar

    MorseMap for local tests

    kotlin val MorseCode = mapOf<String, String>( ".-" to "A", "-..." to "B", "-.-." to "C", "-.." to "D", "." to "E", "..-." to "F", "--." to "G", "...." to "H", ".." to "I", ".---" to "J", "-.-" to "K", ".-.." to "L", "--" to "M", "-." to "N", "---" to "O", ".--." to "P", "--.-" to "Q", ".-." to "R", "..." to "S", "-" to "T", "..-" to "U", "...-" to "V", ".--" to "W", "-..-" to "X", "-.--" to "Y", "--.." to "Z" )

  • MongoJI Avatar

    This comment has been hidden.

  • ShalopaiULTRA Avatar

    When I press "attempt" in output shows a another values(broken or random), but when I testing this code in my computer all works good. Please fix random test. C language.

  • bradykelly69 Avatar

    This comment has been hidden.

  • Alturius Avatar

    Was it just me, or were the unique situations not recognized by the imported library? Was using Java. If I'm not the only one, sorry but this Kata needs work then...

  • YagP Avatar

    if morse doesn't have spaces, that's not morse man

  • Tomas7025 Avatar

    BRO JUST PUT THE ALPHATBET IN THE DESCRIPTION IS JUST PAINFULL BEING STUCKED IN A CHALENGE BECOUSE LACK OF INFORMATION ABOUT THE CONSTRAINS

  • NineteenHockey Avatar

    Hello, I was trying to solve this kata in C and had problems with random tests at freeing pointer I believe (I don't remember exact error message). I was trying reproduce this error to attempt to solve it, but I didn't managed to reproduce it. I tried to output the random tests to try them out, but I still didn't get any error message. Now when I again run the tests (to write down error message and at the same time get another set of random tests) I passed the tests, while there was just 2 random tests there. (I beleive before there were 100 random tests needed, and I was able to output about 20 of them before the error appeared.) What can I do to reproduce the issue, or was there something wrong with kata and that is being fixed right now?

  • rowcased Avatar

    This comment has been hidden.

  • ase444ka Avatar

    eeeee... what&!!:)) 'expected 'SOS! THE QUICK BROWN FOX JUMPS OVER T…' to equal 'SOS! THE QUICK BROWN FOX JUMPS OVER T…''

  • sudar007 Avatar

    This says MorseCode dictionary is preloaded, but java code is not able to find the class. How to load the dictionary. Please help

  • iSoul95 Avatar

    This comment has been hidden.

  • Ascyii Avatar

    In Haskell I get the following error when attempting:

    expected: "SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG." but got: "?! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. "

    Weirdly this test goes through! decodeMorse "... --- ... -.-.-- - .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..- .--- ..- -- .--. ... --- ...- . .-. - .... . .-.. .- --.. -.-- -.. --- --. .-.-.-" shouldBe "SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."

  • Siskiz Avatar

    Good, BUT i don't find inner Java morse code. You will need to write detailed how find this

  • trashy_incel Avatar

    C fork

    • moving the testing code out of preloaded
    • better assertion messages
    • it is explained what kind of pointer to return
  • MrMetty Avatar

    in the C version, I am getting a memory leak. when printing the contents of the morse_code for the random tests;

    at least it looks like one, I get extra text and content that shouldn't be normally available in text.

  • ayousaf21 Avatar

    This comment has been hidden.

  • Anavrin14 Avatar

    This comment has been hidden.

  • sflanker Avatar

    This comment has been hidden.

  • Bouza1 Avatar
    Got ' E E', expected 'E E'

    I'm failing on this test, and i dont really understand what its meant to return, the input contains no .... or __ but it still expects E E?

  • ohno0805 Avatar

    This is pretty rough in NASM.

  • Exodhy Avatar

    This comment has been hidden.

  • Argile5 Avatar

    On the short test, the morse code for HEY JUDE is missing the 3 spaces required to separate HEY and JUDE. So the answer should be HEYJUDE not HEY JUDE.
    On the large test the 3 spaces are present so it is correc as HEY JUDE.

  • Hades4Death Avatar

    Incorrect answer for input=" ...---... -.-.-- - .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..- .--- ..- -- .--. ... --- ...- . .-. - .... . .-.. .- --.. -.-- -.. --- --. .-.-.- ": expected 'SOS! THE QUICK BROWN FOX JUMPS OVER T…' to equal 'SOS! THE QUICK BROWN FOX JUMPS OVER T…'

    so ummm, what's the problem here?

  • johnliter Avatar

    JavaScript Error: Incorrect answer for input=" ...---... -.-.-- - .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..- .--- ..- -- .--. ... --- ...- . .-. - .... . .-.. .- --.. -.-- -.. --- --. .-.-.- ": expected 'SOS THE QUICK BROWN FOX JUMPS OVER TH…' to equal 'SOS! THE QUICK BROWN FOX JUMPS OVER T…'

    I am stumped on this I figured out all the other errors but this one mentioned above.

  • ollieBaker Avatar

    Language selection appears to be broken...

  • UsernameOfUser Avatar

    Where is the preloaded Morse code table for Java?

  • ken.pino Avatar

    I am usin PyCharm to work on these challenges. When I try to import the preloaded module it can't find the MORSE_CODE dict. I opened the preloaded.py file and it's complitely empty. What am I doing wrong?

  • tonyydl Avatar

    testBasicMorseDecoding Expected: is "SOS" but: was "null" Stack Trace Completed in 11ms testMoreComplexTests Expected: is "E" but: was "nullE"

    it's so weird

  • archi_chester Avatar

    Golang: Expected : SOS! THE QUICK BROWN FOX JUMPS OVER THELAZYDOG. to equal : SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. I dont understood why?

  • 1FireWalker1 Avatar

    Expected : HEY JUDE to equal : HEY JUDE

  • dani3015 Avatar

    This comment has been hidden.

  • AllBecomesGood Avatar

    C# had a bug as in that the "Test" button only did 1 test, whereas the "Submit" button did several more. If this can't be reproduced then it might be, because I adjusted the tests, however I restarted the Kata to make sure that didn't affect the tests (and I kept the same issue, so unless the reset didnt properly reset it is bugged as I described).

  • R.Daneel.Olivaw Avatar

    That was awesome! Thanks

  • ejini战神 Avatar

    No random tests in C#

  • m@ng.zu Avatar

    tests are weird ☁︎︎☁︎︎

  • bravoivang Avatar

    A test should include "noise". Add chars that are not dots or dashes or whitespaces

  • ejini战神 Avatar

    No random tests in PHP

  • Xosta Avatar

    This comment has been hidden.

  • 7GreenTea Avatar

    STDERR

    codewarrior/kata

    ./solution.go:62:17: invalid operation: morseCode[letter] + "" (mismatched types byte and untyped string) ./solution.go:62:27: invalid argument: index letter (variable of type string) must be integer

    Help

  • Undercover Unicorn Avatar

    The map in Rust has a mistake, it translates morsecode for colons to commas, if you would solve this Kata wrongly by translating the characters by yourself, youd get an error like this:

    assertion failed: `(left == right)`
      left: `"E6SOS, :GUH_C3U0:51 4 NK(/@OW"`,
     right: `"E6SOS, ,GUH_C3U0,51 4 NK(/@OW"`
    
  • marcie1000 Avatar

    This comment has been hidden.

  • kozy9 Avatar

    This comment has been hidden.

  • Luchik3333333 Avatar

    This comment has been hidden.

  • oribalint Avatar

    I might be doing something wrong since I've only joined yesterday, still, my code works perfectly when I manually input some morse code, however fails when I try to read input in Python. What am I doing wrong?

    decode_morse(input())
                 ^^^^^^^
    

    EOFError: EOF when reading a line

    but

    decode_morse('.... . -.-- .--- ..- -.. .')

    Test Results:

    Log

    HEY JUDE

    Thanks!

  • Vova_Dastrilla Avatar

    The task is good thanks!)

  • matekassa Avatar

    What if there is no spaces between chars like: SOS (...---...)? The most clever solutions faild in the test case for me in Python.

  • Adilson Resende Avatar

    Hi, I can't figure out why my code isn't working (Ran it at my local enviroment and it works) - C# Can someone help me?

    public static string Decode(string morseCode) { List morseCodeWords = morseCode.Trim().Split(" ").ToList(); List words = new List(); foreach (string morseCodeWord in morseCodeWords) { string word = MorseCode.Get(morseCodeWord); words.Add(word); }

    string result = string.Join(" ", words); return result; }

    Sorry for the bad formating, couldn't figure out how to format it.

  • baldricrypto Avatar

    Hello, I have run my code and i pass all the simple tests however keep failing some of the more complex ones. For some reason my code keeps switching around the characters 'E' and '.' and also 'T' and '-'
    i cannot figure this out... as upon debugging my code it seems to collect all the correct characters but when i join the strings it switches them around... any help would be greatly appreciated. :D

  • 66  Avatar

    Language: C++ Preloaded section should include required header std::string

  • luckyvictor Avatar

    I think I got the answer but it fails all of the tests, I read other comments here saying could be extra space, but i have checked it as well and make sure no extra space, I even do a if result == 'HEY JUDE' print ('yes') at the end of the 1st test and it returns yes.

    So what is wrong with my code?

  • tuyysX Avatar

    This comment has been hidden.

  • Dan_Ivy Avatar

    For Julia, why switch from three spaces to two for the complex test cases? Seems unnecessary.

  • jcostagalvez Avatar

    Anyone knows where is de morse code table for Javascript?

  • dinyes Avatar

    This comment has been hidden.

  • am1bestofluck Avatar

    Hand typing all pairs, including "SOS" and punctuation gave Me a good laugh, several times. ...and again after I've figured it is hardcoded already.

  • Jeanca500 Avatar

    Hi, when I run my code in my IDE it works for the test cases, the only difference being that I am using a Morse Code dictionary I found somewhere else.

    It seems to me there might be an issue with the test cases?

    I get the following test output: '.-.-.- .-.-.-' should equal 'HEY JUDE' (The morse code is wrong) '' should equal 'A' '' should equal '7' '' should equal '$' (blank string test cases?)

    Any help would be great thanks!

  • MadCoderLynth Avatar

    So i am getting the right answer but the program doesn't say the 2 strings are equal. For example My string: E Program string: E But still says failed

  • emmeng Avatar

    This comment has been hidden.

  • kahilot1 Avatar

    This comment has been hidden.

  • burger_flipper Avatar

    This comment has been hidden.

  • xg01 Avatar

    This comment has been hidden.

  • CaptainKangaroo Avatar

    This comment has been hidden.

  • Shyam  Avatar

    All the tests are passed but, when i was attemoting it was showing the failures. How can solve this?

  • texasmami Avatar

    I don't know how to keep the space!!! I'm coding in JavaScript, using .split among other stuff, but i think when I split I lose the space! I'm getting HEYJUDE... any suggestions?

  • hobovsky Avatar

    This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/157.
    Please join the discussion to help us identify duplicate kata and retire them.

  • benjaminzwhite Avatar

    This comment has been hidden.

  • Bilal_K20 Avatar

    This comment has been hidden.

  • lawrenceakpainay Avatar

    The test seems to be adding spaces to my returned string; which is causing it to fail. the begining and end of the string is laced with whitespaces. I've tried the removeSuffix and removePrefix functions but it's not helping

  • Vsevolod163 Avatar

    Time: 539ms Exit Code: 1 Test Results: Log HEY JUDE Example from description STDERR Traceback (most recent call last): File "/workspace/default/tests.py", line 16, in testAndPrint(decodeMorse('.... . -.-- .--- ..- -.. .'), 'HEY JUDE') File "/workspace/default/solution.py", line 10, in decode_morse result += MORSE_CODE[morse_code[i]] KeyError: ''

    Hello! I have the right answer, what is the problem here?

  • chrisfrediani Avatar

    There appears to be an issue with the Java version of this Kata. The advanced test seems to have an error, causing the correct code to produce Expected: is "E" but: was "nullE"

    This error occurs even when "E" is the returned String.

  • wjhurley Avatar

    The TypeScript tests are broken for this kata. If you simply run the tests without changing anything you get this:

    TSError: ⨯ Unable to compile TypeScript:
    test.ts:7:12 - error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.
    
    7   expect: (...args) => (assert as any)(...args),
                 ~~~~~~~
    test.ts:8:18 - error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.
    
    8   assertEquals: (...args) => (assert as any).equal(...args),
                       ~~~~~~~
    test.ts:1:22 - error TS6053: File '/runner/typings/mocha/index.d.ts' not found.
    
    1 /// <reference path="/runner/typings/mocha/index.d.ts" />
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test.ts:2:22 - error TS6053: File '/runner/typings/chai/index.d.ts' not found.
    
    2 /// <reference path="/runner/typings/chai/index.d.ts" />
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
        at createTSError (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:513:12)
        at reportTSError (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:517:19)
        at getOutput (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:752:36)
        at Object.compile (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:968:32)
        at Module.m._compile (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:1056:42)
        at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
        at Object.require.extensions.<computed> [as .ts] (/workspace/default/node_modules/.pnpm/ts-node@9.1.1_typescript@4.2.2/node_modules/ts-node/src/index.ts:1059:12)
        at Module.load (internal/modules/cjs/loader.js:928:32)
        at Function.Module._load (internal/modules/cjs/loader.js:769:14)
        at Module.require (internal/modules/cjs/loader.js:952:19)
        at require (internal/modules/cjs/helpers.js:88:18)
        at Object.exports.requireOrImport (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/esm-utils.js:42:12)
        at Object.exports.loadFilesAsync (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/esm-utils.js:55:34)
        at Mocha.loadFilesAsync (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/mocha.js:431:19)
        at singleRun (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/cli/run-helpers.js:125:15)
        at exports.runMocha (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/cli/run-helpers.js:190:10)
        at Object.exports.handler (/workspace/default/node_modules/.pnpm/mocha@8.3.0/node_modules/mocha/lib/cli/run.js:362:11)
        at /workspace/default/node_modules/.pnpm/yargs@16.2.0/node_modules/yargs/build/index.cjs:443:71
    
  • syeo66 Avatar

    Lua: There is something strange going on. It seems it expects you to return two spaces when the input has 6... or something.

    Expected:
    (string) 'XS=( R  /"?T__9=> S&; " /E_T52' /X8B R?QYL 1Z--KI!0U/ FA56@NNGJ 3=>E&"?-SOSZ 2D 2FM J'
                    ^--- Here
    
    Expected:
    (string) '+.(J( P!QSOS4$S&2 97G)581FR'J S- 8 X(2    J,G,FQ)B&7$_EDSOS0=(X,HUEMW _J =A=$ S7(K@4'
                                                    ^--- Here
    

    I don't think this is correct.

  • jsauceda Avatar

    I think there is an issue with tests in Python. My code passes all tests, but I get a STDERR message:

    Time: 508ms Passed: 10 Failed: 0 Exit Code: 1

    Test Results: Example from description [...] Basic Morse decoding [...] Extra zeros handling [...]

    STDERR Traceback (most recent call last): File "/workspace/default/tests.py", line 30, in testAndPrint(decodeMorse(' . . '), 'E E') File "/workspace/default/solution.py", line 11, in decode_morse msg += MORSE_CODE[char] KeyError: ''

  • Lezh1k Avatar

    " ...---... -.-.-- - .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..- .--- ..- -- .--. ... --- ...- . .-. - .... . .-.. .- --.. -.-- -.. --- --. .-.-.- "

    2 spaces should be at the beginning of result, right? So why the expected result is "SOS! THE" instead of " SOS! THE".

    If I ignore first spaces - another test fails. The one where expected result is " E E ".

    I'm using C.

  • MariuszIwaniak Avatar

    Hi, I'm working on morseDecode and I see this fault. Could you give some advise? Cannot invoke "String.isEmpty()" because "" is null

  • aydo Avatar

    This comment has been hidden.

  • ValeryVB Avatar

    https://morsecode.world/international/morse2.html you need all letters + all digits + '.' + '!' + SOS

  • jamesc91_ Avatar

    I pass all cases, but get this error. I'm struggling to correct it

    Traceback (most recent call last): File "/workspace/default/tests.py", line 29, in testAndPrint(decodeMorse(' . '), 'E') File "/workspace/default/solution.py", line 16, in decode_morse wordstring += MORSE_CODE[letterstring] KeyError: ''

  • alanparmenter Avatar

    Suggesting a correction. The statement "SOS (that was first issued by Titanic)" seems to be incorrect, with reference to the following: https://timmaltin.com/2019/04/07/titanic-sos-distress-signal/ "FALSE. SOS was probably first used on 10th June 1909, about three years before the Titanic sank, by the Cunard liner SS Slavonia, when she was wrecked off the Azores."

  • Sasertuga Avatar

    How to add morse code to kotlin. I don't understand...

  • sahealcodes Avatar

    Been Stuck because of the faulty test cases. The 2 test cases in which SOS is expected from given morse Code, there is no space given between the morse code input i.e "...---..." should be given as "... --- ...". This is causing 2 tests to fail which have the words SOS in them. Please Fix the test cases as I can't move further until all the test cases are passed. This Problem is in Javascript.

  • Rhujsie Kajiri Avatar

    This comment has been hidden.

  • NatureSon22 Avatar

    I am using java. How can I invoke the preloaded Morse Table?

  • MaxikForever Avatar

    This comment has been hidden.

  • didierdechez Avatar

    This comment has been hidden.

  • KayleighWasTaken Avatar
  • xArmad Avatar

    This comment has been hidden.

  • PatrykJagielski88 Avatar

    This comment has been hidden.

  • UndertheseaXD Avatar

    This comment has been hidden.

  • Venduk Avatar

    My code works well on Eclipse but on this site computing takes too long so tests cant be executed properly Im annoyed maybe you could raise the computing time needed for harder problems such as this one

  • Bagreli Avatar

    This comment has been hidden.

  • bitblock Avatar

    This comment has been hidden.

  • jojobyng Avatar

    Always read the description :)

  • wannaChill Avatar

    This comment has been hidden.

  • gurrala.reddy Avatar

    This comment has been hidden.

  • Gherno Avatar

    This comment has been hidden.

  • andykov Avatar

    This comment has been hidden.

  • codeeeeeee Avatar

    I passed the first two cases but failed in the last case. It said " Failed asserting that two strings are equal. Expected: 'E' Actual : 'E ' " But when I try it with hardcode, it came out with the expected answer, but I'm keep getting wrong when attempt... Help...

  • Promo01 Avatar

    I passed basic test examples and failed in "complex tests". Is there a way to check the input for each test example?

    Here are the error messages I get:

    Got 'undefinedEundefined', expected 'E' Got 'undefined E Eundefined', expected 'E E'

  • or._.os Avatar

    I wasted a lot of time on this kata because I didn't read the instructions completely, I didn't know there was already a morse code dictionary 'MORSE_CODE[..code]', I went ahead to create my own with an object literal.

  • SamHenkels Avatar

    Definitely issues with the tests in PHP. Given this code: ".-.... .. ....---..." it expects the result to be "SOS".
    Correct me if I'm wrong, but isn't SOS "... --- ..."?

    Why are there spaces in between each letter in the initial tests (with a triple space meaning an ACTUAL space) but it's incredibly inconsistent in the final tests?

  • GoshaamRAI Avatar

    STDERR Traceback (most recent call last): File "tests.py", line 29, in testAndPrint(decodeMorse(' . '), 'E') File "/workspace/default/solution.py", line 8, in decode_morse i[x] = MORSE_CODE[i[x]] KeyError: '' ??? Time: 462ms Passed: 9Failed: 0Exit Code: 1

  • thorXme Avatar

    Got '', expected 'SOS' MY CODE IS RUNNING WELL IN MY INTERPRETOR BUT THERE MAY BE SOME ERROR IN YOUR INPUT HERE ON THE WEBSITE.

  • dweidmann Avatar

    I think there is an issue with the tests in Rust. Just running them without modifications on the initial code gives the following errors:

    error[E0433]: failed to resolve: use of undeclared type `MorseDecoder`
      --> src/lib.rs:26:23
       |
    26 |         let decoder = MorseDecoder::new();
       |                       ^^^^^^^^^^^^ use of undeclared type `MorseDecoder`
    
    error[E0412]: cannot find type `MorseDecoder` in this scope
     --> src/lib.rs:9:6
      |
    9 | impl MorseDecoder {
      |      ^^^^^^^^^^^^ not found in this scope
    
    warning: unused import: `super::*`
      --> src/lib.rs:22:9
       |
    22 |     use super::*;
       |         ^^^^^^^^
       |
       = note: `#[warn(unused_imports)]` on by default
    

    This seems to be an issue with the preloaded struct MorseDecoder. Thanks in advance for any help!

  • MaironGallas Avatar

    I think the tests have a problem! SOS input don't have spaces.

  • blongworth Avatar

    I think there's an issue with tests in Julia:

    decodemorse("----. ---.. --... -.... ..... ....- ...-- ..--- .---- -----") --> "9 8 7 6 5 4 3 2 1 0"

    These characters don't have 4 spaces between them, so the output should be one word per the instructions. Am I missing something?

  • OrangeKekc Avatar

    Hello, I Tried to solve the problem in Python my code passed all tests, but finally I have message: "STDERR Traceback (most recent call last): File "tests.py", line 29, in testAndPrint(decodeMorse(' . '), 'E') File "/workspace/default/solution.py", line 9, in decode_morse text += MORSE_CODE[char] KeyError: ''"

  • kayway Avatar

    Hey great Kata really enjoyed this one as it went for my weakness in c++. But I was wondering what is the rule on includes if there is any. I noticed a much cleaner solution using some includes, and if there is no rule what would you say the best practice is? Either use of includes for cleaner code or muddling through the standard library to understand it better.

  • Priyanka_Sahu Avatar

    Does anyone knows how to use morse code dictionary provided by the author in JavaScript?

  • user9361029 Avatar

    ... --- ...

  • piremi Avatar

    This kata is all about how to organize and manipulate string in array along with undefined character. I learned a lot from this kata!

  • flirtara Avatar

    You do know the name of the function is invalid Python. It should be all lowercase and words seperated by underscores. Per the PEP 8: The Style Guide for Python Code

  • TardnoobiS Avatar

    I dont know why i get the following error: Got '', expected 'SOS'

    Bcs when i write in my code(IDLE) SOS in morse it works and when im testing on the site it dont. (...---... --> SOS)

  • Samuel2508 Avatar

    This comment has been hidden.

  • trustvaldemar Avatar

    very inconsistent in how the morse is written. In a testcase, every letter is separated by a space, except for SOS, which is all one word "...---..." when it should be "... --- ..."

  • AlexGagne Avatar

    This Kata is much harder in F# due to the old F# version used. In later versions, it is possible to do String.Split(" ") to separate only the 3 spaces in-between words. As it stands, the logic required is more complicated for such a simple problem.

  • yanBrandao Avatar

    I can't figure it out why it's happening LMAO.

    expected:<[]E E> but was:<[ ]E E>

    I just split words when find 3 empty spaces like instruction said

    3 spaces are used to separate words

    There's some rule that I didn't undestand?

  • kodaren Avatar

    I can't for the life of me figure out what I am doing wrong, and i'd really appreciate some help.

    All the test PASS except for 2 tests:

    got 'EE', expected 'E E and Got 'SOS!THEQUICKBROWNFOXJUMPSO VERTHELAZYD OG.', expected 'SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'

    What can I be doing wrong?

  • web.borisoff Avatar

    Expected: is "E", but: was "nullE"

    Please show the character that needs to be recoded into the letter "E".

    My characters in the dictionary are as follows: morseCode.put(".", "E"); morseCode.put("·", "E")

  • amIR_a Avatar

    in the submit tests the morse code '...---...' should be '...-- -...'

  • boachiejude Avatar

    This comment has been hidden.

  • Denys-Zvarych Avatar

    This comment has been hidden.

  • dummyaccount Avatar

    formatting the data correctly is the hard part..

  • alanparmenter Avatar

    This comment has been hidden.

  • NikHusachenko Avatar

    Test Failed There seems to be an error somewhere in your code. Exception message reads as follows: The type initializer for 'MorseCodeDecoder' threw an exception.

    What is meen?

  • rgbellotti Avatar

    what is the syntax to use the preloaded dictionary in javascript?

  • Rico-Strenburg Avatar

    How to use the preloaded dictionary in python?

  • veged Avatar

    I suggest test: . . should be E E (i.e. some more trailing whitespaces at the end of input)

  • Nuruddin999 Avatar

    This comment has been hidden.

  • Gunter135 Avatar

    This comment has been hidden.

  • Ainey Avatar

    This comment has been hidden.

  • user9396321 Avatar

    I've written a Racket translation.

  • Slimer JuG Avatar

    This comment has been hidden.

  • thanasisb Avatar

    I pass all tests but exit code:1. Any ideas why does this happen?

  • culMeS4L Avatar

    I mean, the test is actually "...---..." ("SOS") with no blank space in between whatsoever. If I, a human, got a message like that, I would interpret it as "3B", "S:" or "V7", much less a computer.

  • user8333643 Avatar

    I did not understand how to get Morse code dictionary in C#. Is there a MorseCode class in library of classes or should I write it by myself?

  • hotbbqsauce Avatar

    My test code works in my environment. All test cases pass however upon sumbitting its tells me output not as expected how come?

  • damdafayton Avatar

    This comment has been hidden.

  • Dukotelli Avatar

    i dont understand this challenge with the morsecode,what are we suppose to do? details please thank you

  • KomnenGru Avatar

    This comment has been hidden.

  • KomnenGru Avatar

    This comment has been hidden.

  • scavis Avatar

    My code passes all unittests with the exception of the random tests cases. In those random tests the code always cashes. not always at the same point. Error: Test crashed - caught unexpected signal 6. Stderr: free() invalid pointer.

    The issue is that I cant seem to find out what is causing this condition. Tried to print all the incomming arguments but that doesn't seem to work.

    Any thoughts on how to proceed? (im programming in C)

  • Kvothe838 Avatar

    How is the variable MorseCode call in Golang? It doesn't specify and I tried with that name with no luck.

  • simonvantulder Avatar

    MORSE_CODE is the variable name of your dictionary/object/hashtable the morsecode in the brackets is just a placeholder for your dictionary key. took me a long time to figure that out. (If you console.log(MORSE_CODE) it will print out your dictionary.)

  • MrEnderml Avatar

    Hi everyone. JS Error: Got 'SOS THE QUICK BROWN FO JUMPS OVER THE LAZY DOG', expected 'SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.' I have tested two signs: "!" , "." Result: 1.Expected: '!', instead got: '' 2.Expected: '.', instead got: '' I have checked a lot of sites and it hasn't helped me. Does anyone have ideas about it?

  • ginee Avatar

    This comment has been hidden.

  • Judejvlr Avatar

    This comment has been hidden.

  • YoNoSoyVictor Avatar

    is the 'SOS' test broken for python? it's the only one I'm missing.

    it returns ' ', however when I manually introduce it in my program in vscode it returns SOS just as expected.

    I believe it is checking for '...---...' without spaces in between each letter. When it should check for '...(space)---(space)...'

  • Jillsea Avatar

    This was tricky but it was fun to solve it by myself without Linq.

  • Timeaught Avatar

    This comment has been hidden.

  • SunMaster Avatar

    This comment has been hidden.

  • SunMaster Avatar

    This comment has been hidden.

  • SunMaster Avatar

    I've made a NASM translation for this kata, but when it came to creating tests I suddenly realized the c++ version I had solved didn't have any random tests at all.

    Do other languages have random tests?

  • wilsonteh Avatar

    This comment has been hidden.

  • scorpka Avatar

    in pure c:

    Expected: 9@?E$,A"V3:($J CV AE_ ,9SOS O718P0D3 N Submitted: 9@?E$,A"V3:($J CV AE_ ,9SOS O718P0D3 N

    Expected: E Submitted: E Completed in 0.6425ms

  • malibil Avatar

    "The Morse code table is preloaded for you as a dictionary, feel free to use it: Coffeescript/C++/Go/JavaScript/Julia/PHP/Python/Ruby/TypeScript: MORSE_CODE['.--']"

    my language JS but how to use it? i dont know.

  • CMEXOTPOH Avatar

    A pigeon just said, "I love you" in morse code.

  • BalrajMassoun Avatar

    This comment has been hidden.

  • mowens86 Avatar

    This comment has been hidden.

  • puellanivis Avatar

    This comment has been hidden.

  • mflynx Avatar

    This comment has been hidden.

  • helloworld_ Avatar

    This comment has been hidden.

  • smyk.serhi@gmail.com Avatar

    You have some issue in test. My test passed, but yours not Your own tests Test Passed: Value == 'SOS'

    Basic Morse decoding Test Passed Test Passed Test Passed Test Passed Test Passed Got '', expected 'SOS' Test Passed Test Passed Completed in 1ms More complex tests Test Passed Test Passed

  • Iron Fingers Avatar

    How is it that the Lua version alone expects multiple spaces in the final sentence for the random test cases alone? That's not the way it is in the other languages.

  • zLuki Avatar

    Cool kata

  • SuperPowerMan Avatar

    How do i use this: The Morse code table is preloaded for you as a dictionary, feel free to use it:

    Coffeescript/C++/Go/JavaScript/Julia/PHP/Python/Ruby/TypeScript: MORSE_CODE['.--'] ?

  • wantingpawer Avatar

    I'm using C++, the code passes all tests but then segfaults at the end for some reason. The error I'm getting is:

    UndefinedBehaviorSanitizer:DEADLYSIGNAL ==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x7ffdf3af909f (pc 0x000000425b9a bp 0x000000000020 sp 0x7ffcf3af8fd0 T1) ==1==The signal is caused by a READ memory access. ==1==WARNING: invalid path to external symbolizer! ==1==WARNING: Failed to use and restart external symbolizer! #0 0x425b99 (/workspace/test+0x425b99) #1 0x429c48 (/workspace/test+0x429c48) #2 0x4279de (/workspace/test+0x4279de) #3 0x427467 (/workspace/test+0x427467) #4 0x42712b (/workspace/test+0x42712b) #5 0x42b975 (/workspace/test+0x42b975) #6 0x425e5d (/workspace/test+0x425e5d) #7 0x7fa25f5ecb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #8 0x404b99 (/workspace/test+0x404b99)

    UndefinedBehaviorSanitizer can not provide additional info. ==1==ABORTING

    I have no idea what's happening here

  • VeyronRaze Avatar

    I'm using C++, and my code passes all testes, but Extra_zeros_handling.
    As output I get:
    Expected: equal to E Actual:
    And now I'm confused what is Extra_zeros_handling, because what are zeros? What is inputed?
    Because I tested it with:
    000000000000 2242 341645 63457q4ga7ns57 e444657.b 025345362356 00000000000000000
    as input, and it outputs E what is equals to . in Morse.

  • stclennan Avatar

    Working in c++ and get this error, not sure why it is wrong:

    Expected: equal to SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. Actual: SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.

  • Tamao Avatar

    In kotlin: The ".trim()" shouldn't be needed.

  • Prime Phoenix 9 Avatar

    For 2 tests, "SOS" was written as "...---..." instead of "... --- ..."(with spaces), thus preventing the code from interpreting them as 3 seperate letters. I had to make a workaround for both these issues.

    This issue is with respect to python and may be exclusive to its tests.

  • alanblu Avatar

    Hi there!

    I am trying to make this work in Go, any hints about this message?

    Test Failed Log Expected : E to equal : E

  • Talanger Avatar

    This comment has been hidden.

  • raliefrenha2 Avatar

    This comment has been hidden.

  • Slark Avatar

    something fishy about this test log : .-.... .. . can't find the ascii translation for the morse code of .-.... any advice, thanks :)

    i,m using C lang btw

  • kotanridvan Avatar

    The tests are not correct in Swift. The morseCode: label should be added in the method call. So, these should be like XCTAssertEqual(decodeMorse(morseCode: ".... . -.-- .--- ..- -.. ."), "HEY JUDE")

  • N30 Avatar

    I've done this kata in Ruby. It doesn't work in the same tests. In one test it recieved 'SOS' but in the next same test it doesn't.

  • ssshupe Avatar

    I eventually solved this, but would have appreciated seeing in the instructions that there is a 3-space separation between words but only a 2-space separation between numbers. It took me a long time to figure that out, I would have come to the solution much quicker if I'd known that when starting.

  • mayurdaroi93 Avatar

    testMoreComplexTests Expected: is "E" but: was " E" for java.. any suggestions??

  • diamondsea Avatar

    In PHP 7.0 version, the final test is for the string "⎵⎵⎵.⎵⎵⎵.⎵" (where "⎵" represents a space) which returns: Expected: 'E⎵E' Actual : '⎵E⎵E'

    As the string begins with 3 spaces, isn't my Actual response correct, and the Expected response wrong?

  • galenddavis Avatar

    This comment has been hidden.

  • kamillo Avatar

    Hi, Swift translation added.

  • EasyMoney5niper11 Avatar

    Expected: is "E" but: was "nullE" help plz !!

  • maonaparede Avatar

    This comment has been hidden.

  • Richard2957 Avatar

    Before I did this Kata I had never really understood that Javascript arrays are actually Associative Arrays. Very helpful learning experience.