Archive for July, 2007

Calc start date and end date of a given week.
July 16, 2007

from datetime import date, timedelta

def calc(year, week):
d = date(year,1,1)
d = d - timedelta(d.weekday())
dlt = timedelta(days = (week-1)*7)
return d + dlt, d + dlt + timedelta(days=6)

Numbers are passion, Python is fascinating, I am amused
July 16, 2007

The following 4 lines says it all:
x = 2
for y in range(2,24):
… x= x*x*y
… print x, ‘\n’
Watching the generated numbers running on the screen get me so high that I feel I can start writing poetry.
Try it for yourself