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

What will be the next digit in the sentence 1, 1, 2, 3, 5, 8, 13, 21, 34?Please show me your way of thinking :)
Whats is the definition of Parallel Circuit
Who was Samuel F.B. Morse?
What iconic July 4th edible was nicknamed by sports cartoonist Tad Dorgan? a. hot dog b. popsicle c. pop
What's a Protective tariff?
What are two movies which titles relate to 4th of July?
i am having trouble on a math problem for over the summer Use the distributive property to express the sum of 48+84 as a multiple of 2 numbers with no common fa
If you are standing in front of 1600 Pennsylvania Avenue, what are you looking at? a. the Capitol building b. the Metropolitan Museum of Art c. the White Hou
The oldest rock in the world, the Granitic Gneiss, was found in what state?
d = √[( x₂ - x₁) + (y₂ - y₁)] Midpoint Formula Slope Form Distance Formula Quadratic Formula