Count the Vowel
From CompSciWiki
COMP 1010 Home > Back to Extra Labs
Introductioncount the number of vowels in a string given by the user |
Contents |
---|
Solution
First, we need 3 variables:
done = False vowelCount = 0
Second, we need get the input using raw_input(prompt)
#get the input from user input = raw_input("Enter a sentence") if input != ' ':
Then we need to check the vowel
input = input.lower() for char in inputs: #//check if it's a vowel if char == 'a' :
Then we need to use while loop to print the output
while(!done): (...) #output result print '\nVowel count: %d\nVowel percentage: %d%%' % \ (vowelCount, vowelCount * 100 / leng(input))
Now we've done. You should write a complete program.