Day Of Week

Main.DayOfWeek History

Hide minor edits - Show changes to markup

May 03, 2007, at 05:54 PM EST by verbal -
Changed lines 1-24 from:
 #!/usr/bin/python
 #
 #   dow3.py  by Verbal 
 #  Uses Zeller's Congruence to display the day-of-week
 #
 def zeller(m,d,y) :
  # m = input("Month? ")
  # d = input("  Day? ")
  # y = input(" Year? ")
  t = [ 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]

  # y -= ( m < 3 )
  if ( m < 3 ) :
    y = y - 1
  z = ( y + y/4 - y/100 + y/400 + t[m-1] + d ) % 7
  # Sun0, Mon1, Tue2, Wed3, Thr4, Fri5, Sat6
  day = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
  return day[z]
 #
 # ---- main -----
 m = input("Range  1-12 Month? ")
 d = input("Range  1-31   Day? ")
 y = input(" Year? ")
 print "Day-of-week=", zeller(m,d,y)
to:
#!/usr/bin/python
#
#   dow3.py  by Verbal
#  Uses Zeller's Congruence to display the day-of-week
#
def zeller(m,d,y) :
 # m = input("Month? ")
 # d = input("  Day? ")
 # y = input(" Year? ")
 t = [ 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]

 # y -= ( m < 3 )
 if ( m < 3 ) :
   y = y - 1
 z = ( y + y/4 - y/100 + y/400 + t[m-1] + d ) % 7
 # Sun0, Mon1, Tue2, Wed3, Thr4, Fri5, Sat6
 day = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
 return day[z]
#
# ---- main -----
m = input("Range  1-12 Month? ")
d = input("Range  1-31   Day? ")
y = input(" Year? ")
print "Day-of-week=", zeller(m,d,y)
May 03, 2007, at 02:50 PM EST by verval -
Added lines 1-24:
 #!/usr/bin/python
 #
 #   dow3.py  by Verbal 
 #  Uses Zeller's Congruence to display the day-of-week
 #
 def zeller(m,d,y) :
  # m = input("Month? ")
  # d = input("  Day? ")
  # y = input(" Year? ")
  t = [ 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]

  # y -= ( m < 3 )
  if ( m < 3 ) :
    y = y - 1
  z = ( y + y/4 - y/100 + y/400 + t[m-1] + d ) % 7
  # Sun0, Mon1, Tue2, Wed3, Thr4, Fri5, Sat6
  day = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
  return day[z]
 #
 # ---- main -----
 m = input("Range  1-12 Month? ")
 d = input("Range  1-31   Day? ")
 y = input(" Year? ")
 print "Day-of-week=", zeller(m,d,y)