Pair of Consecutive Vowels X50447


Statement
 

pdf   zip   main.py

html

Write a function consec_vow(w) that receives a word (a string consisting only of lowercase letters) and reports the first pair of consecutive vowels found in it (in the standard left-to-right traversal). The output should be a string of length 2 containing the pair of vowels. In case the string does not have consecutive vowels at all, the function must return the 2-letter string ’NO’.

Observation

Only the function will be evaluated. If your submission includes a main program (e.g. with testmod), it must be either commented out or inside a condition if __name__ == ’__main__’

Sample session
>>> consec_vow('myaardvark')
'aa'
>>> consec_vow('aeiou')
'ae'
>>> consec_vow('')
'NO'
>>> consec_vow('supercalifragilisticexpialidocious')
'ia'
>>> consec_vow('incomprehensibility')
'NO'
>>> 3*consec_vow('ucraine')
'aiaiai'
Information
Author
José Luis Balcázar
Language
English
Official solutions
Python
User solutions
Python