This is my code so far for counting vowels. I need to to scan through a sentence, count and compare the vowels and then display the top occurring vowels.
from collections import Counter
vowelCounter = Counter()
sentence=input("sentence")
for word in sentence:
vowelCounter[word] += 1
vowel, vowelCount= Counter(vowel for vowel in sentence.lower() if vowel in "aeiou").most_common(1)[0]
Does anyone have a better way to do this ?
IMO, long lines are best avoided for the sake of clarity:
If all you are after is the max-occurrent vowel, you don't really need
Counter
.