Hello. I am trying to write a compound interest program to show my sister what she will owe her attorney in 5 years when she inherits her money from the estate. She owes her lawyer $12,000 and is refusing to pay him. I wrote the program fine but I am having a problem with decimal points.
My 2 questions.
1.
interest = float(raw_input("Enter interest rate: "))
// I want someone to type something in like 18.5. But in order to do the math right I have to type in .185. How can I fix this so it will treat an entry of 18.5% as .185% for the math? Math would be 12000 * .185 / 365 which gives me the daily interest rate.
2.
When the computer prints the dollar amount it prints $12006.0821918.
How can I get it to not print all the extra numbers? I just want $12006.08.
I am guessing it will round up to the nearest penny.
Thanks!
-Lars
My 2 questions.
1.
interest = float(raw_input("Enter interest rate: "))
// I want someone to type something in like 18.5. But in order to do the math right I have to type in .185. How can I fix this so it will treat an entry of 18.5% as .185% for the math? Math would be 12000 * .185 / 365 which gives me the daily interest rate.
2.
When the computer prints the dollar amount it prints $12006.0821918.
How can I get it to not print all the extra numbers? I just want $12006.08.
I am guessing it will round up to the nearest penny.
Thanks!
-Lars