/* jquery */ /* jquery accordion style*/ /* jquery init */

Python Math - math module

Python Coding

The Python language math module has a good collection of functionallity. Here are a few highlights to help with solving common math problems.


There are a number of useful constants in the math module:

#Import math module
import math



There is a useful factorial() function:

#Import math module
import math

num = input("Enter a number: ")
fac = math.factorial(int(num));
print("Factorial of ", num, " is ", fac)

GCD (Greatest Common Divisor)

This module also has a gcd() function:

#Import math module
import math

print(math.gcd(54, 24))

And there's far more to explore including Logarithmic Functions, Trigonometric Functions, Angular Conversion and Hyperbolic Functions.

For a full list of functionality see the Python3 math module documenation page.

More Python Math Coding

No comments: