On Thu, 2 Nov 2006 04:57:41 -0500, "Barry Roberts" <[EMAIL PROTECTED]>
said:
> I'm still a python novice, but I thouhgt it would be fun to post a
> python solution just for discussion.
Your python reference appears to be about 5 years old. :)
Here's a translation that uses some newer features. Untested, YMMV.
import sys
for line in sys.stdin:
nums = [int(item) for item in line.strip().split()]
numset = set(nums)
for i, item in enumerate(nums[:-1]):
diff = abs(item - nums[i + 1])
if diff in numset:
print "match"
else:
print "not a match"
break
--
C++ is history repeated as tragedy. Java is history repeated as farce. --Scott
McKay
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/