Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit 1dc810d

Browse files
Create text_to_morse_code.py
1 parent a777e4e commit 1dc810d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#all_the symbols
2+
symbols = {
3+
"a": ".-",
4+
"b": "-...",
5+
"c": "-.-.",
6+
"d": "-..",
7+
"e": ".",
8+
"f": "..-.",
9+
"g": ".-",
10+
"h": "....",
11+
"i": "..",
12+
"j": ".---",
13+
"k": "-.-",
14+
"l": ".-..",
15+
"m": "--",
16+
"n": "-.",
17+
"o": "---",
18+
"p": ".--.",
19+
"q": "--.-",
20+
"r": ".-.",
21+
"s": "...",
22+
"t": "-",
23+
"u": "..-",
24+
"v": "...-",
25+
"w": ".--",
26+
"x": "-..-",
27+
"y": "-.--",
28+
"z": "--..",
29+
}
30+
31+
#the user has to tyoe a word
32+
ask = input("type: ")
33+
34+
35+
length = len(ask)
36+
output = ""
37+
38+
for i in range(length):
39+
if ask[i] in symbols.keys():
40+
output = output + " " + symbols.get(ask[i])
41+
42+
print(output)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /