Articles → Python → Mathematical Functions In Python
Mathematical Functions In Python
Mathematical Functions
| Function | Purpose |
|---|
| Abs | abs function is used to find the absolute value of the number. The output of the absolute is always positive |
| Ceil | This function is used to round up the number |
| Floor | This function is used to round down the number |
| Pow | This method returns x raised to the power of y |
Example
import math
print ("Absolute value of -25 is ", abs(-25))
print ("Round up of value 2.35 is ", math.ceil(2.35))
print ("Round up of value -2.35 is ", math.ceil(-2.35))
print ("Round down of value 2.35 is ", math.floor(2.35))
print ("Round down of value -2.35 is ", math.floor(-2.35))
print ("3 raise to the power 4 is ", pow(3,4))
Output
| Posted By - | Karan Gupta |
| |
| Posted On - | Tuesday, February 19, 2019 |