Articles → Python → Mathematical Functions In Python

Mathematical Functions In Python






Mathematical Functions




  1. Abs → abs function is used to find the absolute value of the number. The output of the absolute is always positive
  2. Ceil → This function is used to round up the number
  3. Floor → This function is used to round down the number
  4. 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


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