Write a function which prints the first vowel of each of the words in the list.
ID: 3565855 • Letter: W
Question
Write a function which prints the first vowel of each of the words in the list. For example: Write a function which returns all the vowels which do not appear in the word that is passed as a parameter Write a function called vowelCheck. It is passed a word (i.e., a string), and returns True if the word starts with a vowel and every other letter in the word is a vowel. counter loop with accumulator to solve a numerical problem (no lists or strings) loop with accumulator, but does it need an iterator loop or a counter loop?Explanation / Answer
def firstVowel(l):
for i in range(len(l)):
for j in range(len(l[i])):
if (l[j] == 'a' or l[j] == 'e' or l[j] == 'i' or l[j] == 'o' or l[j] == 'u'):
print l[j]
break
def absentVowels(s):
t = [False,False,False,False,False]
for i in range(s):
if (s[i] == 'a'):
t[0] = True
elif (s[i] == 'e'):
t[1] = True
elif (s[i] == 'i'):
t[2] = True
elif (s[i] == 'o'):
t[3] = True
elif (s[i] == 'u'):
t[4] = True
res = ""
if (t[0] == False):
res += 'a';
if (t[1] == False):
res += 'e';
if (t[2] == False):
res += 'i'
if (t[3] == False):
res += 'o'
if (t[4] == False):
res += 'u'
print res
def VowelCheck(s):
j = 0
while (j < len(s)):
if (s[j] == 'a' or s[j] == 'e' or s[j] == 'i' or s[j] == 'o' or s[j] == 'u'):
continue
else:
return false
j += 2
return true
def square(n):
l = []
for i in range(1,n+1):
l.append(i*i)
print l
dict = {}
def repeats(l):
t = []
for i in range(len(l)):
if (dict.has_key(l[i]) == True):
t.append(l[i])
else:
dict[l[i]] = l[i]
print t
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.