On Wed, 18 May 2005, Carl Cerecke wrote:

Nick Rout wrote:

Carl, you have teaching experience: can you think of a suitable problem?
No cheating by making it too python skewed :)

Me cheat? never!

How about: reading in a file (say /usr/share/dict/words) and producing a frequency count of the letters therein?

ruby -e 'a=Hash.new(0);File.read("/usr/share/dict/words").each_byte{|c| a[c]+=1};a.keys.sort{|b,c|a[b]<=>a[c]}.each{|c| printf "%s %02x %d\n", ?\ < c && c <= ?z ? c.chr : " ", c, a[c]}'
c5 1
ed 2
e4 2
f4 2
e5 3
fb 3
e7 4
e2 6
ea 6
f1 6
f3 10
e1 10
fc 12
f6 13
e8 28
X 58 40
Q 51 56
U 55 108
e9 127
Y 59 130
Z 5a 134
V 56 302
I 49 315
O 4f 344
F 46 470
W 57 476
N 4e 488
J 4a 523
E 45 583
K 4b 620
R 52 707
D 44 765
G 47 765
T 54 766
H 48 824
L 4c 875
P 50 894
A 41 1256
B 42 1297
j 6a 1334
S 53 1376
q 71 1413
C 43 1425
M 4d 1578
x 78 2027
z 7a 2976
w 77 6755
v 76 7425
k 6b 7547
f 66 9839
y 79 12121
b 62 13835
h 68 17932
m 6d 20250
p 70 20528
g 67 21760
' 27 23854
u 75 25184
d 64 27526
c 63 29468
l 6c 39016
o 6f 47074
t 74 50412
r 72 54943
n 6e 55400
a 61 61082
i 69 64957
s 73 84526
e 65 86036
0a 96274



Best to keep it simple, I think.

Simple enough?


John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : [EMAIL PROTECTED] New Zealand

We all live but seconds away from pain and death, yet we live as
though it wasn't even possible.

We are but one person amongst 6 billion, yet we live as though we,
personally, matter.

So, as you were saying... how real did you want me to get?

Reply via email to