I am studying code that writes a program to calculate monthly interest rates for credit card debt. There is a integer that I don't understand it's purpose and just wondering what it represents. It is the only "2" in the code below ... while numMonths <= 12: # Minimum monthly payment of balance at start of the month minPayment = round(minMonthlyPaymentRate * balance,2) totalAmtPaid += minPayment
What language is it? I'm not sure exactly, but I imagine the function round() has two inputs separated by the comma. round(number to be rounded, decimal places to round to) In this case a 2 would give you 12.34 from 12.3455678
Thanks! that would make a lot of sense. I'm writing in Python.
OK then, in Python round(number[, ndigits]) The number of digits is the decimal places. If you omit ndigits it defaults to 0
Join our real-time social learning platform and learn together with your friends!