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

Sketch the graph of each function. Y
Will someone please explain how to do -(7c-18)-2>0 Step for step??? I don't understand how to.
Show how to find the value of six dimes an eight pennies
what is 5,900 round to the nearest thousand
describe 2 ways you could evaluate 37% of the sum of 27 3/5 and 15/9
What is the reason for cleaning dishes, utensils, and food preparation surfaces?
Will someone please explain how to do -(7c-18)-2>0 Step for step??? I don't understand how to.
Why is the ability to adjust conclusions when necessary important to critical thinking?
Some people prefer interval training because      A. the intensity of the exercise doesn't increase, only the time does.B. they can exercise at a steady, but sl
Approximately when did World War I occur? A. 1910s B. 1930s C. 1940s D. 1960s