Python | math.floor() function
In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.floor() function returns the largest integer not greater than x. If number is already integer, same number is returned.
Syntax: math.floor(x) Parameter: x: This is a numeric expression. Returns: largest integer not greater than x.
Code #1:
# Python code to demonstrate the working of floor() # importing "math" for mathematical operations import math x = 33.7 # returning the floor of 33.7 print ("The floor of 33.7 is : ", end ="") print (math.floor(x)) |
chevron_right
filter_none
Output:
The floor of 33.7 is : 33
Code #2:
# Python code to demonstrate the working of floor() # importing "math" for mathematical operations import math # prints the floor using floor() method print ("math.floor(-13.1) : ", math.floor(-13.1)) print ("math.floor(101.96) : ", math.floor(101.96)) |
chevron_right
filter_none
Output:
math.floor(-13.1) : -14 math.floor(101.96) : 101
Recommended Posts:
- Python - Call function from another function
- Help function in Python
- sum() function in Python
- ord() function in Python
- Python | now() function
- Python | cmp() function
- Python tell() function
- Python | int() function
- Python | oct() function
- Python | How to get function name ?
- Python map() function
- Python | dir() function
- id() function in Python
- Python | hex() function
- Python | property() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

