4 Python Math

1. What is the Math Module?

Python has a built-in module called math.

In simple words:
👉 The math module helps us do mathematical work easily
👉 It gives ready-made functions for numbers

Examples:

  • Square root

  • Power

  • Rounding

  • Trigonometry

2. Import Math Module

Before using math functions, we must import it.

Example


 

3. Square Root (sqrt())

Example


 

Output:


 

4. Power of a Number (pow())

Example


 

Output:


 

5. Round Numbers

ceil() – Round UP


 

Output:

floor() – Round DOWN


 

Output:

6. Absolute Value (abs())

Removes minus sign.

Example


 

Output:

7. Find Maximum and Minimum

Example


 

8. Value of Pi (pi)

Example


 

Output:


 

9. Value of Euler’s Number (e)

Example


 

10. Trigonometry Functions

Angles are in radians, not degrees.

Example


 

11. Factorial (factorial())

Example


 

Output:


 

12. Logarithm (log())

Example


 

13. Check if Number is Finite

Example


 

14. Common Beginner Mistakes

❌ Forgetting to Import Math


 

❌ Error.

✔ Correct:


 

❌ Using Degrees Instead of Radians


 

👉 Wrong result.

✔ Correct:


 

15. Simple Practice Examples

Example 1: Area of Circle


 

Example 2: Square and Cube


 

Example 3: Round a Number


 

16. Summary (Python Math)

✔ Math module handles calculations
✔ Must import math
✔ Provides sqrt, power, round, trigonometry
✔ Saves time and effort
✔ Very useful in real programs

📘 Perfect for Beginner eBook

This chapter is ideal for:

  • Python beginner books

  • School & college students

  • Self-learners

If you want next, I can write:

  • Python Statistics

  • Python Random Module

  • Python JSON

  • File Handling

  • Mini Python Projects

Just tell me 😊

You may also like...