Advertisement
Guest User

Untitled

a guest
Oct 18th, 2012
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. def CheckAnswer(pairs, gluingSequence):
  2.     if not gluingSequence:
  3.         return False
  4.     def Glue(pairIndex):
  5.         return ''.join(pairs[i][pairIndex] for i in gluingSequence)
  6.     return Glue(0) == Glue(1)
  7.    
  8. def FindGluingSequence(pairs):
  9.     # FIXME This should actually return something.
  10.     return None
  11.  
  12. if __name__ == '__main__':
  13.     pairs = [
  14.         ('ab', 'a'),
  15.         ('bbaaba', 'a'),
  16.         ('b', 'bbbb'),
  17.         ('bb', 'ab'),
  18.     ]
  19.     print CheckAnswer(pairs, [0, 2, 1, 3, 3, 2])
  20.     print CheckAnswer(pairs, [2, 1, 3, 3, 2, 0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement