Python Program: Functions of Math Module

import math
print("math.pi :",math.pi)
print("math.e :",math.e)
print("math.ceil(1.03) :",math.ceil(1.03))
print("math.floor(1.99) :",math.floor(1.99))
print("math.log10(10) :",math.log10(10))
print("math.sin(90) :",math.sin(90))
print("math.cos(90) :",math.cos(90))
print("math.tan(90) :",math.tan(90))
print("math.degrees(math.pi) :",math.degrees(math.pi))
print("math.degrees(3.14159) :",math.degrees(3.14159))
print("math.radians(180) :",math.radians(180))
print("round(12.157,2) :",round(12.157,2))
print("round(12.157,1) :",round(12.157,1))
print("round(12.157) :",round(12.157))
print("math.fsum([12,25,11])):",math.fsum([12,25,11]))
print("math.gcd(12,20) :",math.gcd(12,20))
print("round(math.pi,2) :",round(math.pi,2))
print("len('Hello') :",len('Hello'))



Output
>>>

math.pi : 3.141592653589793
math.e : 2.718281828459045
math.ceil(1.03) : 2
math.floor(1.99) : 1
math.log10(10) : 1.0
math.sin(90) : 0.8939966636005579
math.cos(90) : -0.4480736161291701
math.tan(90) : -1.995200412208242
math.degrees(math.pi) : 180.0
math.degrees(3.14159) : 179.9998479605043
math.radians(180) : 3.141592653589793
round(12.157,2) : 12.16
round(12.157,1) : 12.2
round(12.157) : 12
math.fsum([12,25,11])): 48.0
math.gcd(12,20) : 4)
round(math.pi,2) : 3.14
len('Hello') : 5
>>>


No comments

Post your comments

Powered by Blogger.