ceil() function in Python #Program for ceil() function Lastly, we used print() function to display the required output. The floor value of our variable ' x' was stored in variable ' y'. Then, we imported math module so that we could use floor() function. We stored the input float value in variable ' x'. The above is a Python program which would get us the floor value of our input float value. floor() function in Python #Program for floor() function Whereas, in case of floor value of the same input returns with 5.īefore using aforementioned functions, we need to import math module. On the other hand, ceil() function returns with the smallest integer which is greater than or equal to our input value.įor instance, if we want to find out the ceiling value of 5.784 then it comes out to be 6. floor() function in our code would return the largest integer which is less than or equal to our input value. In this article, we would discuss floor() and ceil() functions in Python with relevant examples.
0 Comments
Leave a Reply. |