+ 1

Morce code

As you can see this code can encode the word but it doesn't work for decoding. Can you suggest me a way to decode expect make a new list? https://code.sololearn.com/cw52tWH2fWH0/?ref=app

21st Feb 2023, 4:59 AM
Amirhossein Ghannad
10 Respuestas
+ 4
I modified your code to use a `list` for storing encoded/decoded characters. It's then rather easy to glue the `list` elements into a string for display Make functions for encoding & decoding, organize the code better, and reusable. https://code.sololearn.com/cW9ldqmLfwzG/?ref=app
21st Feb 2023, 6:25 AM
Ipang
+ 3
The challenge in decoding a morse coded string is that morse code letters varies in length. So it's tricky unless we know ahead of time what character is used for morse code string delimiter.
21st Feb 2023, 5:33 AM
Ipang
+ 3
derived from Stackoverflow. The suggestion is to tokenize the blank space to simplify the coding and decoding. and because it's Python, there's a pip module for it... https://code.sololearn.com/ccuz6gnzpdhI/?ref=app https://code.sololearn.com/c0AuXQxs4vS1/?ref=app
21st Feb 2023, 9:23 AM
Bob_Li
Bob_Li - avatar
+ 2
Ipang You are probably right. We must pay attention to the fact that each Morse code is separated from the next by a space. So it is possible. Maybe there is a command that can read the list in reverse, then it will be fixed
21st Feb 2023, 5:45 AM
Amirhossein Ghannad
+ 2
The code takes input (regular input not in morse), encode each character into morse, print the encoding result <morce> glued as string. The code then do the reverse, to decode <morce> into regular character in <result>, which is again, glued as string to output.
21st Feb 2023, 7:19 AM
Ipang
+ 2
sounds cool
22nd Feb 2023, 10:02 PM
Ester Allan
Ester Allan - avatar
+ 1
yo wass up
22nd Feb 2023, 10:04 PM
Ester Allan
Ester Allan - avatar
0
Ipang it can't decode the morse coade
21st Feb 2023, 6:32 AM
Amirhossein Ghannad
0
It just prints morse code and words if I input the word But if I input morse code it can't encode
21st Feb 2023, 6:37 AM
Amirhossein Ghannad
0
Bob_Li good job bro Good job If these morses which you added are real
21st Feb 2023, 11:26 AM
Amirhossein Ghannad