|
3260| 4
|
第005讲:闲聊之Python的数据类型 闰年问题 |
|
5鱼币
最佳答案你用的是Python3x吧,python3中16/4=4.0,type(16/4)-是,也即是浮点数,不是int,
因而isinstance(con1,int) == False,isinstance(con2,float)==True,两个逻辑and运算后为False,即
(isinstance(con1,int) and isinstance(con2,float)) == False,第三个isinstance(con3,int)也是一样等于Fale
那么再逻辑运算or后(两边都是Fale),当然永远False了,所以都会print('不是闰年')!!
python2x中9/10=0,也就是向下取整,python3中 ...
| ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
评分 | ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
| ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
| ||
|
小甲鱼最新课程 -> https://ilovefishc.com
|
||
小黑屋|手机版|Archiver|鱼C工作室
( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2026-2-17 19:03
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.