全部博文(362)
分类: Python/Ruby
2009-10-29 16:14:06
用4个正数和4个负数作为3个函数的参数,将返回结果做个比较
>>> for eachnum in (.2,.7,1.2,1.7,-1.2,-1.7):
int(0.2)
floor(0.2)
round(0.2)
--------------------
int(0.7)
floor(0.7)
round(0.7)
--------------------
int(1.2)
floor(1.2)
round(1.2)
--------------------
int(1.7)
floor(1.7)
round(1.7)
--------------------
int(-1.2)
floor(-1.2)
round(-1.2)
--------------------
int(-1.7)
floor(-1.7)
round(-1.7)
--------------------
>>>