Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- letter_to_code = {
- 'A' : 'ALFA',
- 'B' : 'BRAVO',
- 'C' : 'CHARLIE',
- 'D' : 'DELTA',
- 'E' : 'ECHO',
- 'F' : 'FOXTROT',
- 'G' : 'GOLF',
- 'H' : 'HOTEL',
- 'I' : 'INDIA',
- 'J' : 'JULIETT',
- 'K' : 'KILO',
- 'L' : 'LIMA',
- 'M' : 'MIKE',
- 'N' : 'NOVEMBER',
- 'O' : 'OSCAR',
- 'P' : 'PAPA',
- 'Q' : 'QUEBEC',
- 'R' : 'ROMEO',
- 'S' : 'SIERRA',
- 'T' : 'TANGO',
- 'U' : 'UNIFORM',
- 'V' : 'VICTOR',
- 'W' : 'WHISKEY',
- 'X' : 'XRAY',
- 'Y' : 'YANKEE',
- 'Z' : 'ZULU'
- }
- def get_nato_code(char):
- if char.upper() in letter_to_code:
- return letter_to_code[ char.upper() ]
- else:
- return char
- if __name__ == "__main__":
- text=raw_input('Text to NATOfy: ')
- print ''
- print '\n'.join(map(get_nato_code, [c for c in text]))
Add Comment
Please, Sign In to add comment