Michael Tobis wrote:
> As penance I have reduced it from seven lines to six. This one is
> actually tested.
You know, when confronted with this type of little, one-off problems
before, I used to write Perl code like this:
for (1..5)[EMAIL PROTECTED] = sort split //,($_+(chomp($_=<STDIN>))*0);
$t=(@d%2)?($d[int(@d/2)]):([EMAIL PROTECTED]/2-1]);
s/$t/($t<3)?$d[-1]:(($t<6)?$d[0]:(($t<9)?(sub{$s+=$_for(@d);$s%10}->()):0))/e;
print $_+0;}
So when I see code that reads about as easily on a Python list, I think
it might be time to tell people to step back, take a deep breath, and
remember there's a reason they're using Python -- and it's not reducing
the LOC count ;)
--
Ivan Krstić <[EMAIL PROTECTED]> | GPG: 0x147C722D
_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig