Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

def get_pronounciation (pronouncing_line): \"\"\" (str) rightarrow list of str P

ID: 3853792 • Letter: D

Question

def get_pronounciation (pronouncing_line): """ (str) rightarrow list of str Precondition: pronouncing_line has the form: WORD PHONEME_1 PHONEME_2 ... PHONEME_LAST Return a list containing the phonemes in pronouncing_line. >>> get_pronunciation ('ABALONE AE2 B AH0 L OW1 N IY0') ['AE2', 'B', 'AH0', 'L', 'OW1', 'N', 'IY0'] >>> get_pronunciation ('BOX B AA1 K S') ['B', 'AA1', 'K', 'S'] phonemes_list = [] s = pronouncing_line b = s.strip(s[0: (s. find (' '))]) c = [i for i, x in enumerate (b) if x mm ' '] # To do: Add one docstring example above and fill in this # body to meet its specification. def make_pronouncing_table (pronouncing_list): """ (list of str) rightarrow pronouncing table

Explanation / Answer

#Python script for given problem

# Returns list of phonems in given string

def get_pronounciation(pronouncing_line):
   phonems_list=[]
   s=pronouncing_line
   b=s.strip(s[0:(s.find(' '))])
   #print b
   #c=[i for i,x in enumerate(b) if x==' ']
   #print c
   phonems_list=b

#Another example by adding docstring example
   docString='String A BB ED1 AET4 GTG';
   new_list=docString.strip(docString[0:(docString.find(' '))])
   print new_list

#returns phonems_list of given string
   return phonems_list

print get_pronounciation('HELLO AE3 B G AHO L OW1')

#Output :

~/codes/schegg$ python phonetic.py
A BB ED1 AET4 GTG
AE3 B G AHO L OW1