2010

December 9

Python Day of the Week

Suppose that you want to find out the day of the week for some date, especially one some years before or after now, e.g., the day that John Lennon was murdered. If your computer runs Mac OS X or GNU/Linux, you can do it using Python, starting in the terminal application as in the following, where what you type is shown in bold.

$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.date(1980,12,8).strftime('%A')
'Monday'
>>> exit()

$ 

See the documentation for date and strftime.

Note that, of course, you can do this in Windows too, if you’ve installed Python.

posted @ 10:12 AM EST

December 17

Bifurcated Symmetry in the Sign of the Deathly Hallows

Sign of the Deathly Hallows

The sign of the Deathly Hallows has an inherent tension in its symmetry. First, there’s the circle, which is the same no matter how it is rotated. Adding the triangle, restricts the rotational symmetry to just three angles. But the line segment, though on its own has rotational symmetry, when combined with the triangle is the same only in its mirror image; a different kind of symmetry.

posted @ 10:26 AM EST