100-Days-Of-Code/Visual Studio Code Projects/NATO-alphabet-start/main.py
Arcron ArchLinux 4d3a07e207 Fixed Error
2024-10-29 18:08:45 +05:30

17 lines
523 B
Python

import pandas
data = pandas.read_csv("nato_phonetic_alphabet.csv")
phonetic_dict = {row.letter: row.code for (index, row) in data.iterrows()}
print(phonetic_dict)
def generate_phoenetic():
word = input("Enter a word: ").upper()
try:
output_list = [phonetic_dict[letter] for letter in word]
except KeyError:
print("Sorry, only letters in the alphabet, but you can type numbers in words to get the answer.")
generate_phoenetic()
else:
print(output_list)
generate_phoenetic()