小编use*_*ame的帖子

Python语句中的多个条件的简写

if x == y != z:
    print (x + y)
Run Code Online (Sandbox Code Playgroud)

这是if x == y和y!= z的缩写吗?它适用于我的代码,但我不确定当多个条件不是全部​​==或!=时,如何解释多个条件,或者以上面的后一种形式写出来.

python

1
推荐指数
1
解决办法
113
查看次数

为什么Python不包括舍入后小数点后指定的位数?

例如,

a = 5 * 6.2
print (round(a, 2)
Run Code Online (Sandbox Code Playgroud)

输出为31.0.我原以为31.00.

b = 2.3 * 3.2
print (round(b, 3))
Run Code Online (Sandbox Code Playgroud)

输出为7.36.我原以为7.360.

python floating-point rounding

1
推荐指数
3
解决办法
131
查看次数

标签 统计

python ×2

floating-point ×1

rounding ×1