204k views
5 votes
Note: For Python 2

The problem says, “Monthly Minimum Payment Calculator that calculates a month’s minimum credit card payment based on the following two parameters; Minimum required percentage and Credit card balance.” (This is what we need to code in Python 2)
Then, there is a resource that can be used to help with the problem, “Credit cards also use fairly simple math, but it may take some legwork to find out which numbers to use. Lenders typically use a formula to calculate your minimum monthly payment. For example, your card issuer might require that you pay at least 2% of your outstanding balance each month. 1 They might also have a dollar minimum of $25 (so you pay whichever is greater). It’s usually wise to pay more than the minimum (ideally, you pay off the entire balance every month), but the minimum is the amount you must pay to avoid late charges and other penalties.”
Then it gives us an example: “Example: Assume you owe $7,000 on your credit card. Your minimum payment is calculated as 3% of your balance:
Payment=MinRequired x Balance
Payment=0.03 x $7,000
Payment=$210

User Worldask
by
5.5k points

1 Answer

2 votes

In python 2:

def monthlypayment(min_required, balance, dollar_minimum):

if dollar_minimum > min_required * balance:

return "Your minimum payment is $" + str(dollar_minimum)

else:

return "Your minimum payment is $" + str((min_required * balance))

User Tassisto
by
5.5k points