>>>>> "Steve R. Hastings" <[EMAIL PROTECTED]> (SRH) wrote: [snip] >SRH> vowels = frozenset("aeiouAEIOU") >SRH> f = open("a_file.txt") # note that f is an iterator
>SRH> counts = tally(line[0] in vowels for line in f) tally([line[0] in vowels for line in f]) >SRH> # counts is a dict; counts.keys() == [False, True] No guarantee about the order. It could be [True, False]. >SRH> count_nonvowels, count_vowels = counts.values() So you must use counts[False] and counts[True]. -- Piet van Oostrum <[EMAIL PROTECTED]> URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list