jaylalemieu2679 jaylalemieu2679
  • 04-09-2019
  • Computers and Technology
contestada

Write a program that prompts the user to enter a text and displays the number of vowels and consonants in the file. Use a set to store the vowels A, E, I, O, and U.

Respuesta :

Аноним Аноним
  • 04-09-2019

Answer:

Using python

Explanation:

fileName = input("Enter the file to check: ").strip()

infile = open(fileName, "r")

vowels = set("A E I O U a e i o u")

cons = set("b c d f g h j k l m n p q r s t v w x y z B C D F G H J K L M N P Q R S T V W X Y Z")

text = infile.read().split()

countV = 0

for V in text:

if V in vowels:

countV += 1

countC = 0

for C in text:

if C in cons:

countC += 1

print("The number of Vowels is: ",countV,"\nThe number of consonants is: ",countC)

Answer Link

Otras preguntas

All weather activity occurs in which layer of the atmosphere?
how does cell theory work
Why did railroads have a greater impact on American society than did canals and steamboats?
what percent Is 27 percent of 300
1004 divided 39 how do I get the answer
A small highschool class has 9 students were told they would receive a pizza party if their class average was 92% or higher on the next exam. students 1-8 score
Who drove the fastest? Circle the correct answer. A) 363 miles in 6 hours B) 435 miles in 7 hours C) 500 miles in 8 hours D) 215 miles in 5 hours
Who was the leading figure during the French Revolution's Reign of Terror? a. Napoleon Bonaparte b. Louis-Charles c. Maximilien Robespierre d. Marquis de Lafay
The song "happy birthday" begins on? (this is for living music)
Which of the following is NOT a layer of the skin? dermis epidermis endodermis basal cell layer