id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david_petty@psbma.org > thanksgiving
prev  |  next  |  chance

Return the day of the month for US Thanksgiving of year (> 1999). US Thanksgiving occurs on the fourth Thursday of November.

def thanksgiving(year):
    """Return day of month in November on which USA Thanksgiving falls."""
    YEAR = 2000;    # first valid year for this method
    NOV1 = 3;       # 2000/11/01 falls on a Wednesday
    THURSDAY = 4;   # (Sun = 0, Mon = 1, ..., Sat = 6)

thanksgiving(2000) → 23
thanksgiving(2001) → 22
thanksgiving(2002) → 28

...Save, Compile, Run (ctrl-enter)

def thanksgiving(year):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Difficulty: 50

Copyright Nick Parlante 2017 - privacy