β’ 34 words β’ 1 min
from math import floor, ceil
assert floor(3.5) == 3
assert ceil(3.5) == 4
assert floor(3) == 3
assert ceil(3) == 3
assert float(3.4).__round__() == 3
assert round(3.4) == 3
assert round(3.7) == 4
β
Related Posts
When LeetCoding or participating in programming contests, it’s worth to highlight a few differences between C++ and Python:
cpp - maximum β¦
Jun 22, 2026
LeetCode #355: Design Twitter:
My original solution:
python from collections import defaultdict from itertools import chain class Twitter: def β¦
Apr 06, 2026
Previously, previously, previously, previously, previously.
Thiago Perrotta