Counting all the vowels in a passage of text
Change to lower once: text.lower() instead of t.lower() inside loop.
Use t in vowels to check if the character is vowels.
vowels = {...} can be replaced with dict.fromkeys('aeiou', 0) (See dict.fromkeys)

Caution: Use this only if the value is immutable.

&gt;&gt;&gt; dict.fromkeys('aeiou', 0)
{'a': 0, 'i': 0, 'e': 0, 'u': 0, 'o': 0}





vowels = dict.fromkeys('aeiou', 0)

for t in text.lower():  # Change to lower once.
    if t in vowels:
        vowels[t] += 1

print vowels




Alternatively, you can use try ... except KeyError ...:

for t in text.lower():  # Change to lower once.
    try:
        vowels[t] += 1
    except KeyError:  # Ignore consonants.
        pass


Or using battery included, collections.Counter:

from collections import Counter
vowels = Counter(c for c in text.lower() if c in 'aeiou')
# =&gt; Counter({'e': 54, 'a': 41, 'o': 40, 'i': 37, 'u': 14})