Type Here to Get Search Results !

Write Python program to demonstrate math built-in functions

 Write Python program to demonstrate math built-in functions


Math’s built-in Functions: Here is the list of all the functions and attributes defined in math module 


Write Python program to demonstrate math built-in functions


Example

1.Write a program to perform all built in math built-in function


import math

print("Ceil function",math.ceil(1.2))
print("Floor function",math.floor(1.2))
print("power function",math.pow(2,3))
print("Copysign function",math.copysign(2,-1))
print("Factorial function",math.factorial(5))
print("fmod function",math.fmod(5,2))
print("sqrt function",math.sqrt(25))
print("gcd function",math.gcd(3,12))
print("exp function",math.exp(5))


2. Write a Python program to generate a random float where the value is between 5and 50 using Python math module.

import random as mp

print(mp.uniform(5,50));
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Below Post Ad