Created
July 4, 2024 06:41
-
-
Save codecakes/9034856b59dc91c256b739e430a3f212 to your computer and use it in GitHub Desktop.
speak in nato phonetic tongue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NATO_BAG = { | |
'A': 'Alpha', | |
'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': 'X-ray', | |
'Y': 'Yankee', | |
'Z': 'Zulu' | |
} | |
def natorize(word): | |
return " ".join([NATO_BAG[char.upper()] for char in word]) | |
def natorize_sentence(sentence): | |
return " ".join(map(natorize, sentence.split())) | |
assert natorize_sentence("happy birthday") == ("Hotel Alpha Papa Papa Yankee Bravo India Romeo Tango Hotel" | |
" Delta Alpha Yankee") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment