Think Python: How to Think Like a Computer Scientist

(singke) #1

example, “shoe” and “cold” interlock to form “schooled”.


Solution: http://thinkpython2.com/code/interlock.py. Credit: This exercise is inspired by an
example at http://puzzlers.org.


1 . Write   a   program that    finds   all pairs   of  words   that    interlock.  Hint:   don’t   enumerate   all
pairs!

2 . Can you find    any words   that    are three-way   interlocked;    that    is, every   third   letter
forms a word, starting from the first, second or third?
Free download pdf