View the step-by-step solution to:

Question

# I'm still confused about the string

manipulation that's required for the last few specifications.

ZOOM
+
COP2002: Programming Logic &amp; Design with Python
Project 6
Project: Create a program that calculates the interest on a loan. This program
should make it easy for the user to enter numbers.
Sample Console Display:
Welcome to the Interest Calculator
Enter loan amount:
\$100, 000
Enter interest rate: \$2.275
Loan amount :
\$100, 000.00
Interest rate:
2.275%
Interest amount :
\$2, 275.00
Continue? (y/n) : y
Enter loan amount:
65K
Enter interest rate: 4.39
Loan amount :
\$65, 000. 00
Interest rate:
4. 3904
Interest amount :
\$2, 853 . 50
Continue? (y/n) : n
Bye!
Specifications
Use the Decimal class to make sure that all calculations are accurate. It
should round the interest that's calculated to two decimal places, rounding up
if the third decimal place is five or greater.
The interest rate that's displayed can have up to 3 decimal places.
Assume that the user will enter valid decimal values for the loan amount and
interest rate with these exceptions:
If the user enters a dollar sign (\$) at the beginning of the loan amount,
remove it from the string before converting the string to a number.
If the user enters a comma in the loan amount, remove it from the string
before converting the string.
If the user enters a K at the end of the loan amount, remove the K from the
end of the string, and multiply the loan amount by 1000. For example, a
loan amount of 50K should be converted to a value of 50,000.
If the user enters a percent sign () before or after the interest rate, remove
it from the string before converting the string to a number.

print ( "Welcome to the Interest Calculator" ) #Run this loop until user do not quit while (True): #Ask user to provide... View the full answer

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents