# MIT OCW 6.189 # Zeller's Algorithm # July 12, 2013 # This program will determine the day of the week of any given date, # past, present or future. f_name = raw_input(str("What is your first name? ")) print "Enter your date of birth" month, day, year = int(input("Month (1-12) :")), int(input("Day :")), int(raw_input("Year :")) if month <= 2: a, new_year = month + 10, year -1 else: a, new_year = month - 2, year b, c, d = day, new_year % 100, new_year / 100 #print "a = %s, b = %s, c = %s, d = %s, new_year = %s" % (a, b, c, d, new_year) w, x, y = (13*a -1) / 5, c/4, d/4, z = w+x+y+b+c-2*d R = z%7 weekdays = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") print "The date %s/%s/%s falls on a %s" % (month, day, year, weekdays[R])