Answers for "Python Program to Count Vowels and Consonants in a String"

4

count how many vowels in a string python

def vowel_count(string):
  vowels = ['a', 'e', 'i', 'o', 'u']
  return len([i for i in string if i in vowels])
Posted by: Guest on December-04-2020
0

output percentage of vowels and consonants in a given file in python

# Python Program to Count Vowels and Consonants in a String

str1 = input("Please Enter Your Own String : ")
vowels = 0
consonants = 0

for i in str1:
    if(i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u'
       or i == 'A' or i == 'E' or i == 'I' or i == 'O' or i == 'U'):
        vowels = vowels + 1
    else:
        consonants = consonants + 1
 
print("Total Number of Vowels in this String = ", vowels)
print("Total Number of Consonants in this String = ", consonants)
Posted by: Guest on April-30-2020
0

Python Program to Count Vowels and Consonants in a String

pineapple
Posted by: Guest on March-31-2021
0

Python Program to Count Vowels and Consonants in a String

Good Morning
Posted by: Guest on May-22-2021

Code answers related to "Python Program to Count Vowels and Consonants in a String"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language