A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

I can't even get past the first problem set. I try to set raw_input variables to input the credit card data, and then I set additional variables that take that data and do the mathematical operations. After that I do a for loop until 12. I know I am doing something gravely wrong, and I need someone who is better at this to help give me a basic structure of a program.

  • This Question is Open
  1. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Why not post what you have so we can help find and fix the errors?

  2. rsmith6559
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Just a guess, but: raw_input() returns character data. If you want numbers, like an interest rate, you'd need to: interestRate = float( raw_input( "Enter interest rate: " ) ) if( interestRate > 1.0 ): interestRate = interestRate / 100.0

  3. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Excuse me for not being clearer earlier, I was not certain of this format has a character limit or anything. At any rate, I will post what code I have, and yes, I am aware this is terribly wrong. It's also not complete. outstanding_balance=raw_input("What is your outstanding balance?") annual_interest=raw_input("What is your annual interest rate?") min_monthly=raw_input("What is the minimum monthly repayment rate?") mmp = min_monthly * outstanding balance pp = mmp - anaual_interest/12 * outstanding_balance rb = outstanding_balance - pp year=(1,2,3,4,5,6,7,8,9,10,11,12) for months in year: print month print print My thinking was using a for loop to cycle through the 12 months, and then at every iteration (1 month), print out the variables which would take the input data and calculate it.

  4. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Well, what rsmith pointed out is an issue. `outstanding_balance=raw_input("What is your outstanding balance?")` That takes in TEXT. Computers see the text 10 and the number 10 differently. So you need to change it from text to numbers. `outstanding_balance=float(raw_input("What is your outstanding balance? "))` That would change is to a floating point number. int() would change it into a signed integer. The floats allow for decimals, so they help with things like interest, but are not super accurate. Binary representations of decimals end up with rounding issues. Integers, on the other hand, are wonderfully precise... but in computers you can't easily leave things in fractional form. They want 3/2 = 1, not 1.5, in computers thanks to how integers work. So you probably want floats here.

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.