How to round a float down to the nearest integer in Python

1 Answer

0 votes
import math

result = math.floor(5.99)
print(result) 

print(math.floor(5.5))
print(math.floor(5.1))

print(math.floor(-6.9))
print(math.floor(-6.1))



'''
run:

5
5
5
-7
-7

'''

 



answered Jul 16, 2022 by avibootz
...