math.floor()
Anonymous contributor
Published Feb 29, 2024
Contribute to Docs
The math.floor()
function takes in a numeric data type and rounds the value down to the nearest integer.
Syntax
math.floor(n)
The math.floor()
function takes in a value and returns its floor, the smallest integer greater than or equal to that value.
Example
Here’s an example of math.floor()
to return the floor of 134.2
:
import mathprint(math.floor(134.2))
The above code give the following output:
134
Codebyte Example
The following example is runnable and uses the math.floor()
function to return the floor of a number:
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours