35 def encrypt(w): Transform string into pig latin i = firstVowelIndex (w) 36 37 38 39 consonantbeforevowel = W[0:1] 40 word = w[i:] 41 if i != 0: 42 return word +'-+ consonantbeforevowel +'ay' 43...


How do i write encrypt in a simpler way?


35<br>def encrypt(w):<br>Transform string into pig latin<br>i = firstVowelIndex (w)<br>36<br>37<br>38<br>39<br>consonantbeforevowel =<br>W[0:1]<br>40<br>word = w[i:]<br>41<br>if i != 0:<br>42<br>return word +'-+ consonantbeforevowel +'ay'<br>43<br>else:<br>44<br>return w + '-way'<br>45<br>46<br>47<br>48<br>35<br>def encrypt(w):<br>Transform string into pig latin<br>i = firstVowelIndex (w)<br>36<br>37<br>38<br>39<br>consonantbeforevowel =<br>W[0:1]<br>40<br>word = w[i:]<br>41<br>if i != 0:<br>42<br>return word +'-' + consonantbeforevowel + 'ay'<br>43<br>else:<br>44<br>return w + '-way'<br>45<br>46<br>47<br>48<br>

Extracted text: 35 def encrypt(w): Transform string into pig latin i = firstVowelIndex (w) 36 37 38 39 consonantbeforevowel = W[0:1] 40 word = w[i:] 41 if i != 0: 42 return word +'-+ consonantbeforevowel +'ay' 43 else: 44 return w + '-way' 45 46 47 48 35 def encrypt(w): Transform string into pig latin i = firstVowelIndex (w) 36 37 38 39 consonantbeforevowel = W[0:1] 40 word = w[i:] 41 if i != 0: 42 return word +'-' + consonantbeforevowel + 'ay' 43 else: 44 return w + '-way' 45 46 47 48
def firstVowelIndex (w):<br>return the index of the first vowel in the string,<br>unless the first vowel is 'u' and comes after''g' then<br>keep going until another vowel is found annd reurn it's index<br>melen (w)<br>for i in range(m):<br>charzw[i]<br>if char in ['a','A''e''E''1'L'I''o'9: 18 19 20 21 22 23 24 25 26 if w[i-1] not in "Q, 'q'": return 1 27 28 29 else: 30 continue 31 else: 32 return 1 33 if_name == =='_main_ D-D "/>
Extracted text: def firstVowelIndex (w): return the index of the first vowel in the string, unless the first vowel is 'u' and comes after''g' then keep going until another vowel is found annd reurn it's index melen (w) for i in range(m): charzw[i] if char in ['a','A''e''E''1'L'I''o'"0''U''u']: if char in ['u''U'] and i >9: 18 19 20 21 22 23 24 25 26 if w[i-1] not in "Q, 'q'": return 1 27 28 29 else: 30 continue 31 else: 32 return 1 33 if_name == =='_main_ D-D

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here