4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Python】演算子だけで切り捨て切り上げ

Last updated at Posted at 2019-12-27

切り捨て

# 3を2で切り捨て
[in]  3 // 2
[out] 1

切り上げ

# 3を2で切り上げ
[in]  -(-3//2)
[out] 2

もしくは

[in] (3 + 2 - 1) // 2 #(a + b - 1) // b
[out] 2
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?