Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:09:00+00:00 2026-06-10T00:09:00+00:00

In the round function, what means the number 2 as the second argument? ##This

  • 0

In the round function, what means the number 2 as the second argument?

##This is a program that calcs your credit card, and compounds down the total

a=float(raw_input("Enter the outstanding balance on your credit card:"))
b=float(raw_input("Enter the annual crdit card interest rate as a deicimal:"))           
c=float(raw_input("Enter the minimum monthly payment as a decimal:"))
for month in range(1, 13):
    print "Month: ", str(month)
    MMP = round((c * a),2)                  ##the 2 here and below, what does it do?
    print "Minimum monthly payment: ", MMP
    IP = round((b/12 * a),2)
    print "Interest payed: ", IP 
    PP = round(((c*a) - ((b/12)*a)),2)
    print "principal payed: ", PP
    a = round((a - PP),2)
    print "Remaining balance", a 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:09:00+00:00Added an answer on June 10, 2026 at 12:09 am

    The 2 is passed as the second argument to round, giving the number of decimal places to round to. This will round it to the nearest float representing the number rounded to two decimal places. Note that this is a very bad idea and a common source of bugs. Use a fractions.Fraction or decimal.Decimal instead.

    Floats should never be used for money, especially when you’re rounding them like this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The documentation for the round() function states that you pass it a number, and
I am trying to round down a number using PHP's round() function. Here is
Is there a function that can round a float in Fsharp? Something like round(3.21156,3)
Is there a function that can truncate or round a Double? At one point
I need to create a function which rounds decimal numbers like this: Round($32.95, 0)
according to this question: Calling template function without <>; type inference the round function
I have this function to work out the relative time that has elapsed since
Does MySQL make use of any indexes when using the ROUND() function? Consider this
here is my code: $('.round').each ( function ( ) { var content = $(this).html
Using this code v=new Date(); var bxx=document.getElementById('bxx'); function t(){ n=new Date(); ss={time}; s=ss-Math.round((n.getTime()-v.getTime())/1000.); m=0;h=0;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.