python计算闰年的程序_计算闰年 - 问答 - Python中文网

The month of February normally has 28 days. But if it is a leap year, February has 29 days. Write a program that asks the user to enter a year. The program should then display the number of days in February that year. Use the following criteria to identify leap years...

作业以散文形式包含逻辑/步骤;用注释编写步骤,然后将注释转换为代码。在

我已经完成了下面的第一部分,包括相关的“评论说明”。现在在每个注释下面写下代码。除此之外,代码应该包含if/then/else,并使用%(模数)运算符。在# 1. Determine whether the year is divisible by 100.

# If it is, then it is a leap year if and only if it is also divisible by 400 [otherwise it is not a leap year]

# 2. [otherwise, ] If the year is not divisible by 100,

# then it is a leap year if and only if it is divisible by 4 [otherwise it is not a leap year]

要构造代码清理器,请考虑将注释/逻辑放入函数中:

^{pr2}$

编码需要大量的练习。。所以练习一下:)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值