Monday, June 17, 2019

Python math() function



Python math() function




#Python | math() function

import math

# Python code to demonstrate the working of

#demonstrate of math module to pi value
print ("The pi value is : ", end="")
print (math.pi)

#demonstrate of math module to math e value
print ("The math e value is : ", end="")
print (math.e)

#demonstrate of math module sin formula
print ("The sin(10) value is : ", end="")
print (math.sin(10))

#demonstrate of math module cos formula
print ("The cos(10) value is : ", end="")
print (math.cos(10))

#demonstrate of math module log10 formula
print ("The log10(10) value is : ", end="")
print (math.log10(10))

#demonstrate of math module for factorial function
print ("The factorial value of 5 is : ", end="")
print (math.factorial(5))

#demonstrate of math module for square root function
print ("The square root value of 9 is : ", end="")
print (math.sqrt(9))

# Python code to demonstrate the working of
# ceil() and floor()

a = 2.3

# returning the ceil of 2.3
print ("The ceil of 2.3 is : ", end="")
print (math.ceil(a))

# returning the floor of 2.3
print ("The floor of 2.3 is : ", end="")
print (math.floor(a))


# Python code to demonstrate the working of
# fabs() and factorial()

a = -10
b= 5

# returning the absolute value.
print ("The absolute value of -10 is : ", end="")
print (math.fabs(a))

# returning the factorial of 5
print ("The factorial of 5 is : ", end="")
print (math.factorial(b))


1 comment:

  1. I must appreciate you for providing such a valuable content for us. I found so many interesting stuff in your blog Helped a lot in increasing my knowledge ebay bellen

    ReplyDelete

Ethical Hacking Techniques: Cracking WPA/WPA2 Wi-Fi Using WPS and Capturing Handshakes

In the realm of cyber security, ethical hacking plays a crucial role in identifying and addressing vulnerabilities. One of the areas where e...