102k views
1 vote
Write a program that reads one or more strings from the standard input and outputs the count of vowels, consonants, and digit characters found in the stream.

1 Answer

1 vote

Answer:

endinput = "no"

mylist = []

vowel = ['a', 'e', 'i', 'o', 'u']

vowelcount = 0

consonantcount = 0

digitcount = 0

string = " "

number = [ str(i) for i in range(0, 10)]

while endinput == "no":

inputs = input("Enter string value: ")

mylist.append(inputs)

endinput = input("Do you want to end input? ( enter no to continue: ")

for item in mylist:

txt = item

print(txt)

for i in txt:

if i == string:

continue

elif i in vowel:

vowelcount +=1

elif i in number:

digitcount += 1

else:

consonantcount += 1

print("Vowels: ", vowelcount)

print("Digits: ", digitcount)

print("Consonant: ", consonantcount)

Step-by-step explanation:

The python program receives one or more strings from the standard input and appends it to a list. The algorithm iterates through the list of string values and counts the number of vowels, consonants, and digits.

User Miushock
by
7.9k points