Python数値round
abs

round数値

int

指定した桁数に四捨五入した値を返します。

構文

round(number, ndigits?)

使用例

下記の値を入力するとサンプルに即時反映されます。

print
banker
rounding
print(round(3.14159, 2))   # 3.14
print(round(2.5))          # 2  (banker's rounding)
print(round(3.5))          # 4