[Tutor] THE MAIL KING - ah13

Lloyd Kvam lkvam@venix.com
Thu, 04 Oct 2001 13:01:45 -0400


I had already lodged a SPAM complaint about this email when I saw your "reply" come through.  I searched through my trash to make sure it had not been a plea for help.

It's too bad the spammer doesn't actually read the tutor list.  He might get enlightened.

Danny Yoo wrote:
> 
> On Thu, 4 Oct 2001, CC Computer Consulting Co. wrote:
> 
> > Make Every Letter Count - Get Every Letter Opened!
> 
> You've Got Things Reversed And You Have Things Cased.  This is a common
> mistake if you're a newbie to the English language, so we'll forgive you
> for now.  This is Tutor though; we cannot help you learn about word order
> and the proper role of capitalization.
> 
> We can help you with Python though.  You probably meant to say "Make a
> count of every letter":
> 
> ###
> def histogram(thing):
>     counts = {}
>     for element in thing:
>         counts[element] = counts.get(element, 0) + 1
>     return counts
> ###
> 
> This function is pretty useful if you're trying to make sense out of
> "nonsense" --- cryptographers often use histograms to drive their guesses
> of what a message really contains.
> 
> Here's an example that shows how this histogram function works:
> 
> ###
> >>> histogram("> Make Every Letter Count - Get Every Letter Opened!")
> {'>': 1, 'y': 2, 'v': 2, 't': 6, 'u': 1, 'r': 4, 'p': 1, 'n': 2, 'o': 1,
> '-': 1, 'k': 1, 'a': 1, 'd': 1, 'e': 10, ' ': 9, '!': 1, 'O': 1, 'L': 2,
> 'M': 1, 'G': 1, 'E': 2, 'C': 1}
> ###
> 
> There.  Sense out of nonsense.
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-443-6155
fax:	801-459-9582