Python

Uri phrogeeb at hotmail.com
Thu Feb 6 22:33:38 EST 2003


Befuddled newbie attempts a program that calculates compound interest,
using a formula to the effect of:

FV=P(1+r)^n

(FV=Final Value, P = principal, r = interest rate, n = number of
dividends)

Ok, so Python vets I bet are already seeing what my problem is. I ask
for the numbers with the syntax:     r = input("r?")

My problem is that r is a percentage (in my program, I tell the user
to represent 4% as .04).  When I run the program, it says that there's
no way to deal with a double or something to that effect. But I also
read that there's no way to type a variable, that they are
"dynamically typed". Well, that doesn't work here.

So, what do I do?

Thanx in advance.
-Uri
(phrogeeb at hotmail.com)




More information about the Python-list mailing list