import time
import calendar

# time tuple/list index
YEAR = 0
MONTH = 1
DAY = 2
WEEKDAY = 6

# weekdays
MON=0
TUE=1
WED=2
THU=3
FRI=4
SAT=5
SUN=6

# months
JAN=1
FEB=2
MAR=3
APR=4
MAY=5
JUN=6
JUL=7
AUG=8
SEP=9
OCT=10
NOV=11
DEC=12

HAVE_30_DAYS = (APR,JUN,SEP,NOV)
HAVE_31_DAYS = (JAN,MAR,MAY,JUL,AUG,OCT,DEC)
HAVE_28_DAYS = (FEB)

Holidays that I should account for during the Academic year 2009-2010:
Thanksgiving: 11/ 26 - 11/28
Winter Recess: 12/24 - 01/16
Martin Luther King's Birthday: 01/18
Presidents' Day: 02/15
Spring Recess: 03/15 - 03/20
Memorial Day: 05/31
Independence Day: 07/05/08
Summer Recess: 08/7 - 9/6


ideally, the user should be prompted to enter an integer for the month and then prompted to enter an integer for the day. (For example, entering "2" for the month and "14" for the day would represent February 14th.)

The program will tell the student if that date is a vacation day and if so, which one, by printing out a message such as:

February 18 is Presidents' Day.

If the day selected is not a holiday, the program should print out a message such as:

February 17 is not a school holiday.

So, being extremely new to python, I still find this program rather confusing, can someone tell me if I have got it started right/how to make tuples/represent the holidays??

There any many ways to go about it. This uses a list of tuples.

"""
Thanksgiving: 11/ 26 - 11/28 
Winter Recess: 12/24 - 01/16
Martin Luther King's Birthday: 01/18
Presidents' Day: 02/15
Spring Recess: 03/15 - 03/20
Memorial Day: 05/31
Independence Day: 07/05/08
Summer Recess: 08/7 - 9/6
"""
def find_holiday(mm, dd):
                     # month, from_day, to-day, holiday name
    list_of_holidays = [ (11, 26, 28, "Thanksgiving"),
                         (12, 24, 31, "Winter Recess"),
                         (1, 1,   16, "Winter Recess"),
                         (1, 18, 18,  "MLK B'day"),
                         (2, 15, 15,  "Presidents' Day") ]

    for month, from_day, to_day, name in list_of_holidays:
        if (month == mm) and \
           (from_day <= dd <= to_day):
            print("%02d/%02d is %s" % (mm, dd, name)) 
            return

    print("%02d/%02d is not a school holiday" % (mm, dd)) 
    

mm = 12
dd = 25
find_holiday(mm, dd)
mm = 12
dd = 23
find_holiday(mm, dd)

'Appreciate it

So, when are your school days?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.