Question: can you help me to implement function with conditional expression, this is what I have right now, Getting error on this. def first_vowel(s): Returns

can you help me to implement function with conditional expression, this is what I have right now, Getting error on this. def first_vowel(s): """ Returns the position of the first vowel in s; it returns -1 if there are no vowels. We define the vowels to be the letters 'a','e','i','o', and 'u'. The letter 'y' counts as a vowel only if it is not the first letter in the string. Examples: first_vowel('hat') returns 1 first_vowel('grrm') returns -1 first_vowel('sky') returns 2 first_vowel('year') returns 1 Parameter s: the string to search Precondition: s is a nonempty string with only lowercase letters """ result= len(s) a= len(s) b= len(s) c= len(s) d= len(s) e= len(s) f= len(s) if 'a' in (s): a = introcs.index_str(s, 'a') if 'e' in (s): b = introcs.index_str(s, 'e' ) if 'i' in (s): c = introcs.index_str(s, 'i') if 'o' in (s): d = introcs.index_str(s, 'o' ) if 'u' in (s): e = introcs.index_str(s, 'u' ) if 'y' in s and s[0]!='y': f = introcs.index_str(s, 'y' ) g = min(a,b,c,d,e,f) j = int(-1) return j if g > 0 else g

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!