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
|
#!/usr/bin/env python3
nato = [
'Alfa',
'Bravo',
'Charlie',
'Delta',
'Echo',
'Foxtrot',
'Golf',
'Hotel',
'India',
'Juliet',
'Kilo',
'Lima',
'Mike',
'November',
'Oscar',
'Papa',
'Quebec',
'Romeo',
'Sierra',
'Tango',
'Uniform',
'Victor',
'Whiskey',
'X-ray',
'Yankee',
'Zulu',
]
alphabet = { w[0]: w for w in nato }
def str_to_telephony(phrase):
return [ alphabet[c] if c in alphabet else c for c in phrase.upper() ]
import sys
print('\n'.join(str_to_telephony(" ".join(sys.argv[1:]))))
|