codeblock

2016年3月31日 星期四

Python Challenge level 15

http://www.pythonchallenge.com/pc/return/uzi.html (login: huge/file)

- A calendar. January 26. Don't know which year it is. "he ain't the youngest, he is the second". "todo: buy flowers for tomorrow".
- I have to buy flowers on January 27 for a man who is the second and not the youngest one. What?
- Decide to know which year first. You could see the calendar of February on the lower right corner, and find that there was Feb. 29! So the year 1**6 is a multiple of 4. And January 26 is Monday ...

import datetime
#find 1016~1996
year_list = range(1016, 1996+1, 10)
for i in year_list:
 if datetime.date(i, 1, 26).weekday() == 0 and i%4 == 0: print i 
- The result shows:
1176
1356
1576
1756
1976
- "he ain't the youngest, he is the second" => 1756!
- The title is "whom", so maybe it needs a name. Google "17560127", find that it's Mozart's birthday! 
- The answer is "mozart"

沒有留言:

張貼留言