Python 练习 12
2016-05-26 16:49
330 查看
#!/usr/bin/python # -*- coding: UTF-8 -*- year = int(raw_input('year:\n')) month = int(raw_input('month:\n')) day = int(raw_input('day:\n')) months = (0,31,59,90,120,151,181,212,243,273,304,334) if 0 < month <= 12: sum = months[month - 1] else: print 'data error' sum += day leap = 0 if (year % 400 == 0) or ((year % 4 == 0) and (year % 100 != 0)): leap = 1 if (leap == 1) and (month > 2): sum += 1 print 'it is the %dth day.' % sum
相关文章推荐
- Python 练习 11
- python 练习 10
- python 练习 9
- python(十三)正则表达式
- python(十二)I/O编程
- python(十一)异常
- python(十)面向对象编程
- python(九)模块
- lldb调试使用python脚本问题总结
- python(八)装饰器
- python(七)高阶函数,匿名函数
- python(六)切片,生成式,生成器,迭代
- python(五)逻辑运算,函数
- Python 入门:装饰器(decorator)、@functools.wraps、@staticmethod、@classmethod
- python(四)字典,集合,可变与不可变对象(下)
- python(三)字典,集合,可变与不可变对象(上)
- Python 多线程 类和方法
- Python错误与异常
- 生成python程序的exe文件
- python datetime模块基本用法