A community for students. Sign up today!
Here's the question you clicked on:
 0 viewing
 2 years ago
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
 2 years ago
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

This Question is Closed

JocelynC
 2 years ago
Best ResponseYou've already chosen the best response.0x = b x = x print x I have no clue... before yesterday, the highest level programming I've done was on a TI84...

PhilipY
 2 years ago
Best ResponseYou've already chosen the best response.1The 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.

Gianko15
 2 years ago
Best ResponseYou've already chosen the best response.0Ok 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 :$

Gianko15
 2 years ago
Best ResponseYou've already chosen the best response.0Ask 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

alternapop
 one year ago
Best ResponseYou've already chosen the best response.0you 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.
Ask your own question
Ask a QuestionFind more explanations on OpenStudy
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
 Engagement 19 Mad Hatter
 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.