-
输入一个日期,判断该日期是当年的第N天。
例如:输入2022/12/31,这是当年的第365天;输入2020/12/31,这是当年的第366天。
date = input('请输入日期(例:2022/12/31):') datelist = date.split('/') # print(datelist) # 1.先判断闰年或平年 year = int(datelist[0]) if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
字符串、列表练习题
最新推荐文章于 2024-05-09 20:43:47 发布