How (Not?) to Use Python’s List Comprehensions
I think this looks a lot nicer with Haskell-style do notation:<p><pre><code>    import Control.Monad (guard)
    import Data.Ratio ((%))

    results :: [[Int]]
    results = 
      do th &lt;- u 
         o  &lt;- u
         r  &lt;- u
         guard $ 2*th^2 + o^2 + r^2 == 1000
         s  &lt;- u
         z  &lt;- u
         guard $ th^2 * z^2 * (s - z) + s^2 == 7225
         g  &lt;- u
         d  &lt;- u
         xi &lt;- u
         guard $ (g - 1)^2 + d^2 + xi^2 - xi == 600
         (et, i) &lt;- [(xi - 7, xi - 11), (xi - 11, xi - 7), 
                     (xi + 7, xi + 11), (xi + 11, xi + 7)]
         guard $ 0 &lt; et &amp;&amp; et &lt;= 26 &amp;&amp; 0 &lt; i &amp;&amp; i &lt;= 26
         (a, mu) &lt;- [(4, 1), (2, 2), (1, 4)]
         pi &lt;- u
         guard $ a * (a + pi) == 4 * g
         b  &lt;- u
         n  &lt;- u
         guard $ b^3 + z^3 + n^3 + o^9 == 1997
         k  &lt;- [3, 4]
         e  &lt;- u
         guard $ (a % k)^2 + (b % n)^2 + (d % xi)^2 + 
                 (e % pi)^2 + (et % mu)^2 + (i % s)^2 == 6
         return [a, b, g, d, e, z, et, th, i, k, th, mu, n, xi, o, pi, r, s]

      where u = [1..26] 

    main :: IO ()
    main = print results</code></pre>