Skip to content

How to round a number in Python?

>>> import math

>>> math.ceil(5.2)
6

>>> math.ceil(5)
5

>>> math.ceil(-0.5)
0
See also  How to record youtube cc in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.