Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (16.4k points)

In this assignment, I have finished all the issues aside from this one. I need to make a python script to address an equation (screen capture). 

But unfortunately, in my research everywhere on the web, I can't sort out how on earth to either change over ln to log or anything usable, or anything. The code I have composed so far is beneath. I will likewise post the appropriate response that our instructor says we ought to get.

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 appropriate response I ought to get is 36.55539635919235 Any guidance or assist you with having would be significantly appreciated! 

Likewise, we are not utilizing NumPy. I previously attempted that one.

Thank you

1 Answer

0 votes
by (26.4k points)

Here, math.log is actually a natural logarithm

Through this documentation:

math.log(x[, base]) With one argument, return the natural logarithm of x (to base e).

So, your equation will be:

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

Note that in your code you changed n to a str twice which is superfluous.

Are you looking for a good python tutorial? Join the python course fast and gain more knowledge in python.

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
asked Feb 24, 2021 in Python by laddulakshana (16.4k points)
0 votes
2 answers

Browse Categories