Question

In: Computer Science

Write a program that will prompt for a word with at least five letters in it...

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

Solutions

Expert Solution

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))

Related Solutions

Write a Java program that directs the user to enter a single word (of at least...
Write a Java program that directs the user to enter a single word (of at least four characters in length) as input and then prints the word out in reverse in the pattern shown below (please note that the spaces added between each letter are important and should be part of the program you write): <Sample Output Enter a word (at least four characters in length): cat Word must be at least four characters in length, please try again. Enter...
Write a 500 word essay. Prompt: For this week's assignment, you are to write an essay...
Write a 500 word essay. Prompt: For this week's assignment, you are to write an essay in which you explain your stance/perspective on a topic such as parenting, or adoption.
Write a program in Python language which will do the following: Write a program to prompt...
Write a program in Python language which will do the following: Write a program to prompt the user to enter a company name, city, state and zip code. Create a dictionary with the data. Output the dictionary. Then remove the city from the dictionary and output again.
* Write a program texttriangle.py. in python This, too, is not a graphics program. Prompt the...
* Write a program texttriangle.py. in python This, too, is not a graphics program. Prompt the user for a small positive integer value, that I’ll call n. Then use a for-loop with a range function call to make a triangular arrangement of ‘#’characters, with n ‘#’ characters in the last line. Hint: [5] Then leave a blank line. Then make a similar triangle, except start with the line with n ‘#’ characters. To make the second triangle, you can use...
In a c programming Write a program that converts upper case letters to lower case letters...
In a c programming Write a program that converts upper case letters to lower case letters or vice versa: Enter a sentence: What a GREAT movie is! Converted sentence: wHAT_A_great_MOVIE_IS_ Convert all non-alphabetical letters to ‘_’
Write a program that calculates the salary of employees. The program should prompt the user to...
Write a program that calculates the salary of employees. The program should prompt the user to enter hourly rate and number of hours of work a day. Then, the program should display the salary daily, bi-weekly (5 days a week), and monthly. Sample program: Enter your hourly rate: >>> 20 Enter how many hours you work a day: >>> 8 Your daily salary is: $160 Your bi-weekly salary is: $1600 Your monthly: $3200
Write a C program Your program will prompt the user to enter a value for the...
Write a C program Your program will prompt the user to enter a value for the amount of expenses on the credit card. Retrieve the user input using fgets()/sscanf() and save the input value in a variable. The value should be read as type double. The user may or may not enter cents as part of the input. In other words, expect the user to enter values such as 500, 500.00 and 500.10. The program will then prompt the user...
A machine prints a word and the number of letters in this word is a Poisson...
A machine prints a word and the number of letters in this word is a Poisson distributed random variable with parameter λ (so it could possibly have zero letters). However, each letter in the word is printed incorrectly with probability 2/3 independently of all other letters. Compute the expectation and the variance of the number of incorrect letters in the word that the machine prints.
A word is said to be “abecedarian” if the letters in the word appear in alphabetical...
A word is said to be “abecedarian” if the letters in the word appear in alphabetical order. For example, the following are all six-letter English abecedarian words: abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint, beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort, deinos, diluvy, dimpsy Write a method called isAbecedarian that takes a String and returns a boolean indicating whether the word is abecedarian.
IN C This assignment is to write a program that will prompt the user to enter...
IN C This assignment is to write a program that will prompt the user to enter a character, e.g., a percent sign (%), and then the number of percent signs (%) they want on a line. Your program should first read a character from the keyboard, excluding whitespaces; and then print a message indicating that the number must be in the range 1 to 79 (including both ends) if the user enters a number outside of that range. Your program...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT