Articles → Python → Mathematical Functions In Python

Mathematical Functions In Python






Mathematical Functions




FunctionPurpose
Absabs function is used to find the absolute value of the number. The output of the absolute is always positive
CeilThis function is used to round up the number
FloorThis function is used to round down the number
PowThis 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


Picture showing the output of abs, math.ceil, math.floor and pow function in python



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, February 19, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250