3 views
in Python

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

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).

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.