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 ‘_’
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 short essay (300 – 500 words) to answer the following prompt: In a Word...
Write a short essay (300 – 500 words) to answer the following prompt: In a Word document, identify, describe, and explain two key events in the late nineteenth and twentieth centuries that affected global health. How did they do so?
Write a C program with the following prompt *do not use gotostatement* "Write an interactive...
Write a C program with the following prompt *do not use goto statement* "Write an interactive program that implements a simple calculator. The program should allow the user to choose a binary arithmetic operation and enter two terms to which to apply the operation. The program should then compute the result and display it to the user. Your calculator will have two modes: double-precision mode and integer mode. Double-precision mode will do calculations and output using variables of type double....
in basic c++ program please!! Write a word search and word count program. Assign the following...
in basic c++ program please!! Write a word search and word count program. Assign the following text to a string constant. For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life. For God did not send his Son into the world to condemn the world, but to save the world through him.Whoever believes in him is not condemned, but whoever does not believe stands...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT