Last active
July 4, 2019 01:12
-
-
Save Tsubajashi/d3603185b0c78583f2ef429a42bface8 to your computer and use it in GitHub Desktop.
Count Vowels and Consonants inside a Sentence in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
strSentence = input('Enter Sentence here: ') | |
arrVowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] | |
intVowelCount = 0 | |
arrConsonants = ['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'] | |
intConsonantCount = 0 | |
for string in strSentence: | |
for i in arrVowels: | |
if string == i: | |
intVowelCount += 1 | |
for i in arrConsonants: | |
if string == i: | |
intKonsonantenanzahl += 1 | |
print('There are %s Vowels and %s Consonants found in the Setence.' %(intVowelCount, intConsonantCount)) | |
os.system("pause") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment