DECROMAX

Nato_conversion

Nov 14th, 2021
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. nato_words = ['Alfa', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf', 'Hotel', 'India', 'Juliet', 'Kilo',
  2.               'Lima', 'Mike', 'November', 'Oscar', 'Papa', 'Quebec', 'Romeo', 'Sierra', 'Tango', 'Uniform', 'Victor',
  3.               'Whiskey', 'X-ray', 'Yankee', 'Zulu']
  4.  
  5.  
  6. def nato_convert(word):
  7.     letter_index = [ord(i.lower()) - 96 for i in word if i.isalpha()]
  8.     conversion = [nato_words[i - 1] for i in letter_index]
  9.     print(*conversion, sep=', ')
  10.  
  11. nato_convert('Hello Friend')
Advertisement
Add Comment
Please, Sign In to add comment