Wednesday, June 23, 2010

python challenge: room 3

python challenge: room 3

here's my solution:
import re

infile = open('c:\\python26\\MyProgs\\inputfile_room3.txt' , 'r')
instring = infile.read()
infile.close()


p = re.compile( r'[^A-Z][A-Z]{3}(?P<answer>[a-z])[A-Z]{3}[^A-Z]') 
print p.findall(instring)


#solution is "linkedlist"



solution url:
http://www.pythonchallenge.com/pc/def/linkedlist.php

No comments: