In: Computer Science
Write a program that will prompt for a word with at least five letters in it (if not, keep asking for input). Then evaluate the word to produce a count of all the vowels in the word. Sample output appears below.
Enter a word at least 5 characters
long:<SPC>cat<ENTER>
Enter a word at least 5 characters
long:<SPC>dog<ENTER>
Enter a word at least 5 characters
long:<SPC>concatenate<ENTER>
Letter Counts
=========
a: 2
e: 2
i: 0
o: 1
u: 0
Code and output
Code for copying
n=str(input("Enter a word at least 5 characters long: "))
while len(n)<=5:
n=str(input("Enter a word at least 5 characters long: "))
print("Letter Counts")
print("=============")
a=n.count("a")
e=n.count("e")
i=n.count("i")
o=n.count("o")
u=n.count("u")
print("a: {}".format(a))
print("e: {}".format(e))
print("i: {}".format(i))
print("o: {}".format(o))
print("u: {}".format(u))
Code snippet
n=str(input("Enter a word at least 5 characters long: "))
while len(n)<=5:
n=str(input("Enter a word at least 5 characters long: "))
print("Letter Counts")
print("=============")
a=n.count("a")
e=n.count("e")
i=n.count("i")
o=n.count("o")
u=n.count("u")
print("a: {}".format(a))
print("e: {}".format(e))
print("i: {}".format(i))
print("o: {}".format(o))
print("u: {}".format(u))