anonymous
  • anonymous
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
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
x = b x = x print x I have no clue... before yesterday, the highest level programming I've done was on a TI-84...
anonymous
  • anonymous
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.
anonymous
  • anonymous
i isn't used at all

Looking for something else?

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

More answers

anonymous
  • anonymous
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 :$
anonymous
  • anonymous
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
anonymous
  • anonymous
Kay. Thanks :D!
anonymous
  • anonymous
you're welcome
anonymous
  • anonymous
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.

Looking for something else?

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