EDIT: I first gave the wrong reason why this is not working. As others have pointed out,
if month == 1 or 10:
# ...
is equivalent to
if (month == 1) or 10:
# ...
So ...
always gets executed.
You could use
if month in (1, 10):
month1 = 0
or even better
a = [0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5]
month1 = a[month - 1]
or
d = {1: 0, 2: 3, 3: 3, 4: 6, 5: 1, 6: 4,
7: 6, 8: 2, 9: 5, 10: 0, 11: 3, 12: 5}
month1 = d[month]
instead.
Yet another way of getting the same result would be to use the datetime
module:
from datetime import datetime
month1 = (datetime(2011, month, 1) - datetime(2011, 1, 1)).days % 7