[Edu-sig] Computer Hatred
Kirby Urner
urnerk at qwest.net
Thu Sep 25 11:56:41 EDT 2003
>>> import string
>>> text = (
"""
I have my hopes up that I'll be getting some more front lines field
experience teaching a Python + math mix, starting in October.
A homeschooler mom is getting some kids together (around middle school age)
and is planning to rent space at FreeGeek, the local cast-off computer
recycler (they recombine parts the work to make FreekBoxes, many of which go
home with the refurbisher volunteers).
Whereas there's some carry-over from the calculator, in that Python features
an interactive command line, probably it's a good idea to start showing
things Python does that calculators have a hard time with. In particular,
programming calculators is hard because of the small screen -- the higher
end ones connect to a computer console at this point.
Calculators also have a hard time doing stuff with letters.
"""
)
>>> def letfreq(txt):
txt = txt.upper()
for char in string.ascii_uppercase + ' ':
print "%s --> %s" % (char, txt.count(char))
>>> letfreq(text)
A --> 53
B --> 8
C --> 31
D --> 15
E --> 78
F --> 13
G --> 18
H --> 40
I --> 40
J --> 0
K --> 5
L --> 28
M --> 25
N --> 37
O --> 55
P --> 15
Q --> 0
R --> 46
S --> 38
T --> 64
U --> 14
V --> 6
W --> 7
X --> 3
Y --> 9
Z --> 0
--> 132
Kirby
More information about the Edu-sig
mailing list