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

Could Obama Possibly be the worst president in the 5 of the U.S.
are stratus clouds or cirrus clouds found closer to the ground
Why men and women could become victims of violence
What country did Japan defeat in its FIRST foreign war during the Meiji period?
analyze how your weight would change with time if you were on a space ship traveling away from earth toward the moon
Who led the Russian Revolution of 1917? a. the Nazis b. the fascists c. the bolsheoiks
analyze how your weight would change with time if you were on a space ship traveling away from earth toward the moon
What is the x and y intercept of -x -6y=12
Why does pottery take so long to dry?
what important event occurred during the industrial and scientific revolutions