##Example 1 word = input("What word should we test? ") vowels = "aeiouAEIOUyY" syllables = 0 for index in range(len(word)): character = word[index] #if index == 0 and character in vowels: # syllables = syllables + 1 # print(character) if character in vowels and word[index - 1] not in vowels: syllables = syllables + 1 #print(character) if character == "e" and index == len(word)-1: syllables = syllables - 1 if syllables == 0: syllables = 1 print(syllables) ######################### ##Example 2 word = input("What word should we test? ") vowels = "aeiouy" count = 0 for index in range(len(word)): character = word[index] if character in vowels: count = count + 1 if index>0: if word[index-1] in vowels: count = count - 1 if word[len(word)-1]=="e": count = count -1 if count == 0: count = 1 print(count) ######################### ##Example 3 count = 0 vowel = "aeiouy" word = input("What word should we test? ") for index in range(len(word)): if word[index] in vowel: count = count + 1 if index!=0 and word[index-1] in vowel: count = count - 1 if word[len(word)-1]=='e': count = count - 1 if count==0: count = count + 1 print(count) ######################### ##Example 4 vowels="aeiouy" score=0 repeat=0 test=input("What word should we test? ") for i in range(len(test)): character=test[i] last=test[-1] if character in vowels: score=score+1 if i<=(len(test)-2): if character in vowels: after=test[i+1] if after in vowels: repeat=repeat+1 if last=="e": score=score-1 score=score-repeat if score==0: print(1) else: print(score) ######################### ##Example 5 word=input("What word should we test? ") vowels = "aeiouy" count=0 for index in range(len(word)): char = word[index] if char in vowels: count+=1 if index==(len(word)-1) and char=="e": count-=1 if (index>0 and (word[index-1] in vowels)): count-=1 if count==0: count=1 print(count)