Python Forum
How to fix bugs in Morse alphabet code?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fix bugs in Morse alphabet code?
#3
(Oct-25-2021, 09:10 PM)bowlofred Wrote: Your function reads the data not into morse_text but into mroz_text. Probably a typo?

def decode(mroz_text: str) -> str:
    morse_array = morse_text.split("/")

Yes, and I also changed plaintext to plain_text but now i have there


Traceback (most recent call last):
File "C:/Users/dokipo/Desktop/pythonprojects/alphabet.py", line 29, in <module>
print(decode(encode("This is first testing sentence.")))
File "C:/Users/dokipo/Desktop/pythonprojects/alphabet.py", line 25, in <module>
plain_text += morse[current_element]
builtins.KeyError: 't'


What´s wrong with "t"?
Reply


Messages In This Thread
How to fix bugs in Morse alphabet code? - by dokipo - Oct-25-2021, 08:39 PM
RE: How to fix bugs in Morse alphabet code? - by dokipo - Oct-25-2021, 09:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  (python) Can i get some help fixing a English to Morse translator? Pls AlexPython 7 1,662 Sep-12-2022, 02:55 AM
Last Post: AlexPython
  reset on inactivity (building a morse decoder) gerrit1985 7 3,593 Apr-17-2020, 10:22 AM
Last Post: deanhystad
  How do you switch all alphabet into different characters? SteampunkMaverick12 1 2,180 Apr-27-2018, 12:09 AM
Last Post: ODIS

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020