We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c7dcc7f + 1dc810d commit 4151e9eCopy full SHA for 4151e9e
projects/text_to_morse_code/text_to_morse_code.py
@@ -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