Python Math Floor
Now, we are going to learn about the floor method. As the name of the method suggests, with the floor method, we are going to get the greatest integer less than or equal to x. so, the floor method takes in an argument, which is a number, and it returns the floor of the number.
Let’s have a look at a simple program, which demonstrates the same thing –
Python Math Floor
As you can see in the above program, we have imported the math module, and then we are calling the floor method. We are passing the argument as 5.7 to the floor method. The floor method returns the greatest integer less than or equal to the given argument. So, if we try to execute the above program, we get the output as 5, which is the greatest integer, less than or equal to 5.7. We have directly printed the output, but you can also store it for future access in the program.
So, as and when required, we can make use of the floor method in our Python programs. Remember that the floor method returns the greatest number less than or equal to the given argument.