diff options
-rwxr-xr-x | nato.py | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | |||
3 | nato = [ | ||
4 | 'Alfa', | ||
5 | 'Bravo', | ||
6 | 'Charlie', | ||
7 | 'Delta', | ||
8 | 'Echo', | ||
9 | 'Foxtrot', | ||
10 | 'Golf', | ||
11 | 'Hotel', | ||
12 | 'India', | ||
13 | 'Juliet', | ||
14 | 'Kilo', | ||
15 | 'Lima', | ||
16 | 'Mike', | ||
17 | 'November', | ||
18 | 'Oscar', | ||
19 | 'Papa', | ||
20 | 'Quebec', | ||
21 | 'Romeo', | ||
22 | 'Sierra', | ||
23 | 'Tango', | ||
24 | 'Uniform', | ||
25 | 'Victor', | ||
26 | 'Whiskey', | ||
27 | 'X-ray', | ||
28 | 'Yankee', | ||
29 | 'Zulu', | ||
30 | ] | ||
31 | |||
32 | alphabet = { w[0]: w for w in nato } | ||
33 | |||
34 | def str_to_telephony(phrase): | ||
35 | return [ alphabet[c] if c in alphabet else c for c in phrase.upper() ] | ||
36 | |||
37 | |||
38 | import sys | ||
39 | |||
40 | print('\n'.join(str_to_telephony(" ".join(sys.argv[1:])))) | ||