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

Jacob buys four muffins for 5.00 what is the cost of 7 muffins
the ratio of basketballs to footballs in coach Farrell's pe class is 10.:3. if there are 52 total balls in the class, how many basketballs and football are ther
During the Civil Rights movement, Martin Luther King, Jr. and other leaders insisted upon avoiding violence in the pursuit of equality. Why do you think the non
Please help on 8, 9, and 10! Each answer must Be 9! PLEASE With shown work HELP IS APPRECIATED!EXAMPLE*4,4,4,44÷4+4+4^1+4+4^5 + 4^9
Distribute. 9(2 - 9x^2)
Sperm begin in the _______.
how many molecules are contained in a 3.36 mole sample of NH3?
Why us it necessaryvto eliminate absolutely all invasive fire ant colonies to eradicate the invasive population
- 5 ( 4x + 2 ) + 2x + 1 = - 151
Which energy is stored in the bonds between atoms? kinetic thermal chemical mechanical