I have to figure out the time taken for one of my inputs to triple using a compound interest equation. The users have to input the expected annual return and the initial stock price, and the code is supposed to spit out the number of years (rounded up to whole number) it takes for that initial stock price to triple. However, with the code I've written it simply gives me nothing, and I have no idea what to do.
My code:
from sympy.solvers import solve
from sympy import Symbol
x = Symbol('x')
Stock_Ticker = input("Enter the stock ticker: ")
EAR = float(input("Enter Expected Annual Return: "))
ISP = float(input("Enter initial stock price: "))
expr = ISP * (1+EAR)**x
solve(ISP *(1+EAR)**x,x)
sol = solve(ISP *(1+EAR)**x,x)
print ("The price of", Stock_Ticker, "tripled after", sol, "years")
My output is:
The price of (Stock_Ticker) tripled after [] years