simultaneous assignment

Heiko Wundram me+python at
Tue May 2 23:23:36 CEST 2006

Am Dienstag 02 Mai 2006 22:47 schrieb Gary Duzan:
> >Here's a scan of the page from the puzzle book:
> >
> >
> >Basically I'm reading this book to give me little things to try out in
> >Python. There's no guarantee that this puzzle is even conducive to (or
> >worthy of) a programming solution.
> Given the appropriate spy() function, this will return a set of
> values for the truthful (logically coherent) spy and nothing for
> the other spy. The details are left as an exercise for the reader.

Hummm... Isn't it easier and faster to solve this problem by hand than to code 
a Python program for it? I had proofs for what has to be on both papers in 
about 30 seconds... ;-)

If you're looking for things to code in Python, I'd rather suggest you look at 
number theory than at logic problems. Basically, every logic problem can be 
solved by exhaustive search (which is always the same algorithm), whereas a 
number theory problem requires that you implement a certain algorithm from 
scratch for each problem you're trying to tackle.

Implementing the sieve of Erathosthenes comes to mind straight away.

--- Heiko.

More information about the Python-list mailing list