您的位置:首页 > 编程语言 > Python开发

使用python 3.x 对pythonchallenge-----15的解答过程

2017-09-22 15:07 423 查看
pythonchallenge-15地址:http://www.pythonchallenge.com/pc/return/uzi.html


题目解析:图片是一个月日历,1**6.1.26这个日期被圈出来了,然后看日历下方2月份是29天,很明显当年是润年。
在源代码中出现了<!--heain'ttheyoungest,heisthesecond--><!--todo:buyflowersfortomorrow-->。就是说找到第倒数第二小的日期,然后日期的明天是一个重要日期

解题过程:


#http://www.pythonchallenge.com/pc/return/uzi.html importdatetime importcalendar foriinrange(1006,2016,10): t_str=str(i)+'-01-27' d=datetime.datetime.strptime(t_str,'%Y-%m-%d') ifd.weekday()==1andcalendar.isleap(d.year): print(t_str)

答案:1756-01-27

1176-01-27 1356-01-27 1576-01-27 1756-01-27 1976-01-27

通过百度查到#沃尔夫冈·阿玛多伊斯·莫扎特(WolfgangAmadeusMozart,1756年1月27日-1791年12月5日)

答案就是Mozart


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: