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 horizontal space available. Please 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 reserve the right to delete or edit code contributions where the approach is unclear, not well documented or downright inelegant! 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: