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

the media's role is primarily entertainment, so it has little effect on our wellness. True or false
the freezing point of water is the same as ice's __________ point. a. boiling b. melting c. condensing d. sublimation
va rog scriitemi ienunturi cu ia i-a ea
16-3n verbal expression?
what is 6789 / 33please show work you guys
You have several pieces of wood 0.83m 1.26m 0.53m 4.09m 3.5m add the lengths together to give the total length
Find the product of −2 1/4 and 2 1/2. enter answer as a mixed number in simplest form.
During the 1970's which price of legislation did the national organization for women actively promote though it was never ratified
Your family is going to host two french students, Alsin and Camille, for the school year. Write five questions to find out what activities they do
tom hanks voice was which characterin toy story 2