python 简单习题系列1
2014-06-01 23:05
246 查看
题目: 计算今年是不是闰年? 闰年的条件: 满足整除400,或者整除4而不能整除100.
#coding:utf-8 ''' check this year is a leap year or not ''' import time # get this year this_year = time.localtime()[0] #this_year = 2008 #you can test any year you want print ('This year is: %s . ' % this_year) # check this year if is a leap year, and print the check result. if this_year%400 == 0 or this_year%4 == 0 and this_year%100 != 0: print ('It is a leap year.') else: print ('It is not a leap year.')
相关文章推荐
- python简单习题系列2
- python简单习题系列3
- python简单习题系列6
- python 简单习题系列5
- python简单习题系列4
- 简单递推系列 uva习题
- 【数据结构&&算法系列】插入排序简单介绍及python代码
- Appium+Genymotion+robotframework+python系列三:一个简单的Android自动化用例
- python变量和简单数据类型的简单习题
- python各种简单习题汇总
- CDays-2 习题二 (编写类Class,并实现简单的栈)及相关内容解析。Python 基础教程 Class
- python爬虫系列(1)——一个简单的爬虫实例
- Python爬虫系列之----Scrapy(四)一个简单的示例
- 【数据结构&&算法系列】归并排序简单介绍及python代码
- $python爬虫系列(1)——一个简单的爬虫实例
- Python基础系列----环境的搭建及简单输入、输出
- 【python系列】matplotlib简单画图subplot
- python第三方库系列之十六--建立最简单的web服务器
- python 笔记 if语句的简单使用 《笨办法学Python》习题29 ——1.2
- 【MQTT应用学习系列(一)】Apollo代理+paho_mqtt开发Python客户端实现MQTT简单通信