Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! `env python` -t
- def main():
- """
- Project Euler #19
- =================
- How many months in the 20th century started on a
- Sunday.
- 20th century is 1 Jan 1901 to 31 Dec 2000
- In the Python date module, Sunday is day 6.
- """
- import datetime
- Sunday=6
- sum=0
- for year in xrange(1901, 2001):
- for month in xrange(1,13):
- if datetime.date(year, month, 1).weekday() \
- == Sunday:
- sum+=1
- return sum
- # end 'main'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement