What are the two constants available in math module? How are they used?

 

Answer:

The two constants available in math module are:

  • e = 2.718281... 
  • pi = 3.141592…

These are imported using the statements:

  • from math import pi
  • from math import e

Now they can be used directly in the program.

Example:

  • Area = pi * r * r
  • C = e**10
Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo