Python 基础(1)

来源:互联网 发布:java sftp下载文件夹 编辑:程序博客网 时间:2024/06/04 19:09

1、判断输入的年份是否为闰年:Python代码如下

下面是Python 2 的代码:

while True:    num = int(raw_input('please input a number:'))    if (num%4==0 and num%100!=0) or num%400==0:        print 'yes'        break    print 'no'


0 0
原创粉丝点击