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

a map has a scale of 2 in : 25 mi. The map shows a highway is 31 inches long. how long is the actual highway?
simplify p8/p2can you help me with this question...anyonnnneee...????
can we store electricity from lightning?
Which sentence does not contain any errors? A. Fortunately, information on they're collars helped us locate the owners of the dogs.
the area of Alicia's garden is 81 square feet. what are the dimensions of her garden?
solve the formula for the indicated variable  c=yt+y,for t (the solution is t=___)
the resultant resistance of two resistance wires in series combination is 108 ohm and in parallel combination is 24 ohm. find the value of individual resistance
what is the common name for calcium silicate?
What Is the Connection Between Sulfuric Acid and Hydrochloric Acid?
Solve for y.8^3-3y=256^4y