This is a site for people who have an interest in using the Python programming language to solve the mathematical and logic puzzles published weekly by the Sunday Times in the United Kingdom. If your interest is in ‘paper and pencil’ solutions you should be using this site as the aim here is to consider programmed solutions in Python.
If you post comments including Python code here, you can apply syntax highlighting by putting:
before your code and:
afterwards. Please use spaces rather than tabs with two spaces for indents in order to make the best use of the limited horizontal space available. Please also use Python 3 rather than Python 2 (if you use Python 2, import and use the functional form of the print statement).
Since the aim here is to provide neat, understandable and reasonably efficient Python code for solving teasers, I would be grateful if people who post their own code on this site would stay close to the Python PEP8 style guide (other than the 4 space indents!) so that the site maintains a consistent ‘look and feel’. Also please note that I reserve the right to edit (or even delete) code contributions where the approach is unclear, not well documented, or poorly formatted. Please do not post code in languages other than Python.
I am using Mathjax to format mathematics on this site and this facility is also available in comments. The initial and final delimiters for display equations are a backslash followed by [ and ]; for inline equations they are a backslash followed by ( and ). For example: