Nato Generator

#Important Note: You will need the nato.csv file.

import pandas
data = pandas.read_csv("nato.csv")
phonetic_code_dict = {row.character: row.code for (index, row) in data.iterrows()}
print(phonetic_code_dict)
def call_back():
phoneticCodeGenerator()

def phoneticCodeGenerator():
word = input("Enter a word or a phrase!").upper()
try:
output_list = [phonetic_code_dict[letter] for letter in word]

except KeyError:
print("Sorry, only characters that are in the alphabet and basic grammar marks!")
phoneticCodeGenerator()
else:
print(output_list)
nato_continue = input("Do you want another message? Press 1 for yes or 0 for no!")
if nato_continue == str(1) or nato_continue == "yes":
call_back()

phoneticCodeGenerator()

#Important Note: You will need to click the link to download the file or create your own nato.csv file.

Nato CSV File



character,code
A,Alfa B,Bravo C,Charlie D,Delta E,Echo F,Foxtrot G,Golf H,Hotel I,India J,Juliet K,Kilo L,Lima M,Mike N,Nice O,Oscar P,Papa Q,Quebec R,Romeo S,Sierra T,Tango U,Uniform V,Victor W,Wine X,X-ray Y,Yankee Z,Zulu 1,Alpha 2,Belonging 3,Calling 4,Delightful 5,Eternal 6,Forgetful 7,Great 8,Hungry 9,Interrupt 0,Zealous .,Peter !,Example ?,Qualify ;,Split -,Hyper ,Space ",",Calculate ,Apple