summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnato.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/nato.py b/nato.py
new file mode 100755
index 0000000..a8788e0
--- /dev/null
+++ b/nato.py
@@ -0,0 +1,40 @@
1#!/usr/bin/env python3
2
3nato = [
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
32alphabet = { w[0]: w for w in nato }
33
34def str_to_telephony(phrase):
35 return [ alphabet[c] if c in alphabet else c for c in phrase.upper() ]
36
37
38import sys
39
40print('\n'.join(str_to_telephony(" ".join(sys.argv[1:]))))