请用函数实现一个判断用户输入的年份是否是闰年的程序

def fun():
    year = int(input("只要你输入一个年份我就可以告诉你是否是闰年:"))
    # if (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
    if (year % 400 is 0) or (year % 4 is 0 and year % 100 is not 0):
        print("您输入的年份[%d]是润年" % year)
    else:
        print("您输入的年份[%d]不是润年" % year)
fun()

猜你喜欢

转载自blog.csdn.net/dubo_csdn/article/details/85597641
今日推荐