How is math.ceil(89.7) different from math.floor (89.7)?
Question
How is math.ceil(89.7) different from math.floor (89.7)?
✨ Free AI Tools for You
Powered by Chatterbot AI
Answer
The **math.ceil**
and **math.floor**
functions in Python's math module perform rounding operations, but they do so differently:
math.ceil(89.7): This function returns the smallest integer greater than or equal to 89.7, which is 90.
math.floor(89.7): This function returns the largest integer less than or equal to 89.7, which is 89.
In summary:
math.ceil(89.7) = 90
math.floor(89.7) = 89
India's 1st AI Doubt Solver for CBSE, JEE, and NEET
Ask a Question for Freeand then it's just ₹212 a month