CHAPTER 43   •   PYTHON

Python Math

Learn mathematical functions using the math module.

01 What is this?

Learn mathematical functions using the math module.

02 Syntax

Python Syntax
math.function(value)

03 Example

Python Example
import math

print(math.sqrt(16))
print(math.ceil(4.2))
print(math.floor(4.8))

04 Important Points

The math module provides many mathematical functions.

05 Common Mistakes

Import math before using its functions.

06 Real World Use

Math functions are useful in scientific and financial programs.

07 Practice This Topic

Now try the example yourself in the AIFA Python Editor.

  • Read the example carefully.
  • Change the values.
  • Run the code.
  • Observe the output.
  • Try creating your own example.
Try It Yourself →