Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

JocelynC

Hello. A newbie is a little (very) confused on problem set 1 question 1, "Credit Card Debt." I watched lectures 1, 2 and the first recitation, and feel as if I understand them, so I may not know the necessary information. I'm actually a little confused...on where to start. This is my godawful attempt at starting the problem: x = float(raw_input('Enter current balance ')) y = float(raw_input('Enter annual interest rate ')) z = float(raw_input('Enter minimum monthly payment rate ')) for i in range(1,13): t = x * z p = (y/12.0) * x r = t - p b = x - r

  • one year ago
  • one year ago

  • This Question is Closed
  1. JocelynC
    Best Response
    You've already chosen the best response.
    Medals 0

    x = b x = x print x I have no clue... before yesterday, the highest level programming I've done was on a TI-84...

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

    The user raw input code looks good, and I did the for loop as well in this problem. Using the test case 1, after the 3 user inputs, they printed out "Month: 1", "Min monthly payment: " etc... So.. for i in range(1,13): print 'Month: ', i t = x * z print 'Minimum monthly payment: ', t etc.. all the equations in the loop look good, but I would change the last one, var b. Rather than using var b, I just used something like x = x - r So the balance changes itself. This is just the approach I took to the problem and I'm sure there are many ways to get the same results.

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

    i isn't used at all

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

    Ok your code seems good, but you don't need to do: x = b x = x print x That's unnecessary, you just put after the for loop, "print b" or with some text to be more understandable for you and others, something like: print 'resultado:',b You can improve the for loop, you want to run over 12 times, just use: for i in range(12); When I started I confused putting the limits :$

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

    Ask as many as you want, is better if you use less variables, cuz the less line code the better, but if your variables are like, rates, balance, etc; in that case where you would update them, will be usefull have each one in variables, is up to you most of the time. If you make x = 10.0/3; x = 3.3333333333, to round, just use: round(x,#ofDigits) -> round(x,2) = 3.33

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

    Kay. Thanks :D!

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

    you're welcome

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

    you might want to consider using variable names that give an idea about what they are used for. "balance" instead of "x", "interest_rate" instead of "y". it makes it easier to read and troubleshoot, both for you and those trying to help.

    • one year ago
    • Attachments:

See more questions >>>

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.