We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1a34e5 commit 68397a2Copy full SHA for 68397a2
Day-26-NATOPhoneticAlphabet/main.py
@@ -3,6 +3,12 @@
3
nato_df = pd.read_csv('nato_phonetic_alphabet.csv')
4
nato_dict = {row.letter:row.code for (index,row) in nato_df.iterrows()}
5
6
-word = input('Enter word here:\n').upper()
7
-list = [nato_dict[letter] for letter in word if letter!=' ' ]
8
-print(list)
+while True:
+ word = input('Enter word here:\n').upper()
+ try:
9
+ list = [nato_dict[letter] for letter in word if letter!=' ' ]
10
+ except KeyError:
11
+ print('Sorry, only letter in the alphabet please')
12
+ else:
13
+ print(list)
14
+ break
0 commit comments