Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Create text_to_morse_code.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RgTheGreat authored Oct 25, 2021
1 parent a777e4e commit 1dc810d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions projects/text_to_morse_code/text_to_morse_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#all_the symbols
symbols = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"g": ".-",
"h": "....",
"i": "..",
"j": ".---",
"k": "-.-",
"l": ".-..",
"m": "--",
"n": "-.",
"o": "---",
"p": ".--.",
"q": "--.-",
"r": ".-.",
"s": "...",
"t": "-",
"u": "..-",
"v": "...-",
"w": ".--",
"x": "-..-",
"y": "-.--",
"z": "--..",
}

#the user has to tyoe a word
ask = input("type: ")


length = len(ask)
output = ""

for i in range(length):
if ask[i] in symbols.keys():
output = output + " " + symbols.get(ask[i])

print(output)

0 comments on commit 1dc810d

Please sign in to comment.