ln Natural Log in Python

0 votes

I need to create a python script to solve this equation.

formula
 

The code I have written so far is:

import math
p = 100
r = 0.06 / 12
FV = 4000

n = str(ln * ((1 + (FV * r) / p) / (ln * (1 + r))))

print ("Number of periods = " + str(n))

The answer I should get is 36.55539635919235. Can someone help me with this? 

Apr 25 in Python by Kichu
• 19,040 points
72 views

1 answer to this question.

0 votes

Use math.log it is a natural logarithm. For more info: https://docs.python.org/2/library/math.html.

Rewrite your equation as:

n = math.log((1 + (FV * r) / p) / math.log(1 + r)))

I hope this helps.

answered Apr 25 by narikkadan
• 10,840 points

Related Questions In Python

0 votes
0 answers

How to print square of first 100 natural numbers using iterations in python?

Can you make a program with nested ...READ MORE

Jul 22, 2019 in Python by Waseem
• 4,540 points
311 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,890 points
16,650 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
568 views
+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
3,129 views
0 votes
1 answer

Section postgresql not found in the database.ini file

Python doesn't know what $FILEDIR is. Try an absolute path ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 58,080 points
1,925 views
0 votes
1 answer

Iterating over dictionaries using 'for' loops

key is just a variable name. for key ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,300 points
517 views
0 votes
1 answer

Conflicting dependencies of pypyodbc and blpapi

I figured out that pypyodbc only works ...READ MORE

answered Oct 9, 2018 in Python by Priyaj
• 58,080 points
319 views
0 votes
1 answer

Programmatically generate video or animated GIF in Python?

You can use  ImageMagick. Save your frames ...READ MORE

answered Apr 25 in Python by narikkadan
• 10,840 points
31 views
0 votes
1 answer

Simple prime number generator in Python

There are some problems with your code. You ...READ MORE

answered Apr 25 in Python by narikkadan
• 10,840 points
29 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP