Articles

Python program to find natural log of a number

Python program to find natural log of a number


In this python program guide, we will learn to write:

  • program to find natural log of a number in python

Program to find Natural log of a number in Python

Please check our video tutorial on program to find natural log of a number in python:

 

 

The python program to find natural log of a number is as follows:

 

# Owner : TutorialsInhand Author : Devjeet Roy

import math

number = int(input("Enter the number: "))

ans = math.log(number)

print("The value is:",ans)

The output of python program to find log of a number is as follows:

 

PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter the number: 5
The value is: 1.6094379124341003

Few important points about this program:

1. To do mathematical operations, we need to import the math library.

2. The math library provides many log formulae, like loge, log10, log2 etc.

3. We find the natural log using the .log() method in the math library.

 

python program to find log of a number

 

This wraps up our session on python program to find natural log or python program to find log of a number.


Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com

About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :    Published Date : Nov 13,2022  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!