-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
63 lines (60 loc) · 1.11 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CODE = {
"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": "__..",
"0": "_____",
"1": ".____",
"2": "..___",
"3": "...__",
"4": "...._",
"5": ".....",
"6": "_....",
"7": "__...",
"8": "___..",
"9": "____.",
".": "._._._",
",": "__..__",
"?": "..__..",
"'": ".____.",
"!": "_._.__",
"/": "_.._.",
"(": "_.__.",
")": "_.__._",
"&": "._...",
":": "___...",
";": "_._._.",
"=": "_..._",
"+": "._._.",
"-": "_...._",
"_": "..__._",
"\"": "._.._.",
"$": "..._.._",
"@": ".__._.",
" ": "/"
}
letters = [letter.upper() for letter in list(input("Enter the text: "))]
morse_code = [CODE[letter] for letter in letters]
print(f"Morse Code: {" ".join(morse_code)}")