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.
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...
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...
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.
This program will write a series of letters, starting with 'A', to an external file (letters.txt)....
This program will write a series of letters, starting with 'A', to an external file (letters.txt). The user will decide how many letters in total get saved to the file. ** IMPORTANT: The test cases will evaluate your code against .txt files that I uploaded. You do NOT have to upload your own txt files. Input: Including 'A', how many total letters would you like to store? [user types: 26] Output (in the file, not in the console window) A...
write a program to perform the following in C Your program should prompt the user to...
write a program to perform the following in C Your program should prompt the user to enter ten words, one at a time, which are to be stored in an array of strings. After all of the words have been entered, the list is to be reordered as necessary to place the words into alphabetical order, regardless of case. Once the list is in alphabetical order, the list should be output to the console in order. The program should execute...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT