#输入年份和月份,用Python判断这年这月有多少天

#日常笔记

while True:
    def isLeep(y):
        result = y%4==0 and y%100!=0 or y%400==0
        return result
    days = [0,31,28,31,30,31,30,31,31,30,31,30,31]
    year = int(input("年份:"))
    manth = int(input("月份:"))
    if isLeep(year):
        days[2] = 29
    print("天数:",days[manth])

转载于:https://my.oschina.net/u/4138052/blog/3053451

你可能感兴趣的:(#输入年份和月份,用Python判断这年这月有多少天)