vowelIndex Write a function vowelIndex that accepts a word (a str) as an argument and returns the index of the first vowel in the word. If there is no vowel, -1 is returned. For this problem, both upper and lower case vowels count, and 'y' is not considered to be a vowel. Sample usage: >>> vowelIndex('hello') 1 >>> vowelIndex('string') 3 >>> vowelIndex('string') 3 >>> vowelIndex('BUY') 1 >>> vowelIndex('APPLE') 0 >>> vowelIndex('nymphly') -1 >>> vowelIndex('string')==3 True >>> vowel Index ('nymphly')==-1 True

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 2PP
icon
Related questions
Question
vowelIndex
Write a function vowelIndex that accepts a word (a str) as an argument and returns the index
of the first vowel in the word. If there is no vowel, -1 is returned. For this problem, both upper
and lower case vowels count, and 'y' is not considered to be a vowel. Sample usage:
>>> vowelIndex('hello')
1
>>> vowelIndex('string')
3
>>> vowelIndex('string')
3
>>> vowelIndex('BUY')
1
>>> vowelIndex('APPLE')
0
>>> vowelIndex('nymphly')
-1
>>> vowelIndex('string')==3
True
>>> vowel Index ('nymphly')==-1
True
Transcribed Image Text:vowelIndex Write a function vowelIndex that accepts a word (a str) as an argument and returns the index of the first vowel in the word. If there is no vowel, -1 is returned. For this problem, both upper and lower case vowels count, and 'y' is not considered to be a vowel. Sample usage: >>> vowelIndex('hello') 1 >>> vowelIndex('string') 3 >>> vowelIndex('string') 3 >>> vowelIndex('BUY') 1 >>> vowelIndex('APPLE') 0 >>> vowelIndex('nymphly') -1 >>> vowelIndex('string')==3 True >>> vowel Index ('nymphly')==-1 True
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning