if x == y != z:
print (x + y)
Run Code Online (Sandbox Code Playgroud)
这是if x == y和y!= z的缩写吗?它适用于我的代码,但我不确定当多个条件不是全部==或!=时,如何解释多个条件,或者以上面的后一种形式写出来.
例如,
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.